How do you set min and max values for alarms?

Greetings,

I am attaching my code (which works in a basic sense) with a block image that is obviously the wrong way to do things. I am trying to enter a maximum and minimum temperature and humidity in the calculator section and have the alarms (spoken text) sound when conditions are exceeded. The block image I attached seems to me like where I should be testing but I get errors when running.

Might someone suggest where to place my four if statements for testing? As I think I have tried everywhere with no success, this might be the wrong approach.

BLE_Cannot_Compare.aia (3.1 MB)

If there is anything else I am missing in order to help you help me, please advise. I think I am, once again, over thinking this. Thank you for reading.

I am on my phone.

Double check those characteristics for upper case.

You only upshifted one side of each comparison.

Which errors do you get? Example?
Taifun

For lack of any error message info, let's throw things against the wall and see what sticks ...

Your BLE version is not the latest.

Why do you need 4 copies of the BLE extension?

image

If you are going to initialize these 4 limit values to empty text, you would need to add extra code to the incoming data checks to skip the limit tests if the limits are not numbers.

The numeric compare blocks do not suffer non-numeric inputs lightly.


I did the first two for you.

Good Morning,

I am sorry I am so dense but I just do not see in my code what you are saying regarding upper case characteristics and "upshifted." I did, however, come closer to success. Please review my general response to myself at your convenience and, perhaps, render a suggestion or two?

to have the exact error message would help...
Taifun

What response?
You didn't post new code

Greetings,

OK, I moved the if/than's into a 10-second clock and set the BLE transmission rate of my Arduino to 2000ms giving me 2-second updates and 10-second reports. The only solution I am now seeking (my brain is fried) is how to broadcast all of the true if/than's sequentually, not at the same time as is now happening. What IS now happening (IMHO) is that the temperature alarms sound but the humidity alarms overwrite them as the humidity if/than is hot on the heels of the temperature if/than. I need a way to tell the system to wait on reporting the humidity data until the temperarure data is reported.


BTW, thank you for your mentoring. I am starting to actually grock some of the data flow and structure of my app (and that is a very good thing!).

Senior moment! :neutral_face: Please review the post I sent to you at your convenience.

Greetings and thank you so much for your response. I am being exceptionally dense, as I do not understand the highlighted block sequence you sent to me. Regarding error messages, I finally got the issue solved (ABG suggested using IsNumber?) commands and I am down to trying to prevent a second spoken alarm from overwriting a first spoken alarm before it even gets started. I will insert my clock2 block that makes the reports every ten seconds (with overwriting),

Here's a sample app that shows how to queue up speech and have it announced serially without overlap.


speech_queue.aia (21.6 KB)

Instead of speaking directly, feed the text to the blabber procedure.
It handles the speech.

Good Morning ABG and @Taifun i

I have been working hard at grocking lists. I didn't know until this morning that lists were dynamic, in that removing index 1 now shifts everything such that what was index 2 is now index 1. Somewhere, I seem to be telling the system that my list is only 1 item long when it could contain up to 4 items.

Given this, I thought I had this issue wrapped but I received the following error message:
aaaaaaaaerror

I have three blocks of interest:

I am now running in circles but I believe I am close and the fix is simple. If someone sees the erro of my ways, please be so kind as to point it out and correct me. Thank you so much!

Here you are trying to set something at index 4
The error message is trying to tell you, that the list is empty.


This obviously will only work if the list does have min. 3 items
What about using the add items to list block instead?

From the documentation MIT App Inventor List Blocks

Adds the given items to the end of the list. This block is a mutator.

Taifun

You have several problems to fix.

  1. The AI2 AND block checks its inputs in a specific order, and that can be used for good or for evil.

Text comparison of two multi-digit numbers is risky, if the number of digits changes or one of them goes negative or zero. To deal with that, check in the first branch of the AND if the limit is a number (not blank too), and save the second AND clause for a good old fashioned numeric (blue) >= test.

  1. Use the ADD ITEM to List block instead of assuming reserved seating. Lists expand and contract with the number of items in them, like a chain expands and contracts as you add or remove links from the chain.

  2. This is how you should test if a list is empty (0 items) or not:
    lists_is_empty

Trying to select any item number from a list that has not been checked for emptiness is doomed to fail.

Greetings, Gentlemen

I did some housekeeping and reinovation to my code but I still have an error that I do not grock. I will list the three previous *revised" blocks and my error in hope this elicits a knowledge response in you and a solution when you are finished ROTFL.

Revised_Error

I call the second block my problem button because, when I click on it, I get my error. I thought the "Not" + "IsListEmpty" in the if/then would prevent this from happening.

you probably hear that the first time, but what abourt using Do it to debug your blocks?

use Do it together with the companion app to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun

Hi, again, @Taifun and @ABG. Interesting. This is the first time I have successfully connected my AI2 browser to the companion. I went through the motions and, when all was said and done, the do it system returned the error message I previously posted. Clicking the ATMO1.Click is still the problem. It says I am trying to test from a list of 1 when the list is empty but I thought the "not" + "IsListEmpty" would prevent this from happening. IMHO, NotIsListEmpty should stop the system from seeing a list item of index 1 until index 1 actually exists. This is not happening. I feel as though I am very close, but still unable to make this code work as I expect it to. ATMO1.Click still brings up this error:

Revised_Error