Bluetooth Connection in other screens

I added it to the button that stop all of it and the procedure that contains all the things that should happen once it reads the contains of "!!" but still the same thing... I'm not sure how it is reading both of the arduino button's emergency texts without me even clicking the button

Where is the place that you set the RoomAlertText.Text to blank?

1 Like

As of right now here are my alert blocks:

Another thing to consider:

Your Arduino code is set to delay 50 ms between messages.
How many ms does your Clock Timer wait before checking the next incoming message?
Unless it's faster (less ms) than the Arduino, those extra messages will pile up in the AI2 BT input buffer, and keep coming, until you have stopped the Arduino from sending them and until you have cleared all the input messages.
Here's what might happen, courtesy of Lucy and Ethel ...

1 Like

Okay so delay the message, i'll delay the message. hopefully it'll work

increasing the delay value just delays the emrgency txts sent to the alerttxt label, the alert layour still pops up immediately after connected to the bluetooth....

You have two possibilities ...

  • Your Arduino is still sending alerts
  • Your app is still responding to old alerts.

I notice in your Arduino code that you might be skipping incoming bytes with value 13 in this code sequence, expecting alternate lights and alerts values, instead of single values that need to be examined to see if they are a light or an alert value.

 
  if(Serial2.available()){
  
    //Room1 Lights(Apps)
    lights = Serial2.read();
    if(lights == 1) digitalWrite(LedR1, HIGH);
    if(lights == 2) digitalWrite(LedR1, LOW);
    if(lights == 3) digitalWrite(LedR2, HIGH);
    if(lights == 4) digitalWrite(LedR2, LOW);
    if(lights == 5) digitalWrite(LedR3, HIGH);
    if(lights == 6) digitalWrite(LedR3, LOW);
    if(lights == 7) digitalWrite(LedR4, HIGH);
    if(lights == 8) digitalWrite(LedR4, LOW);
    if(lights == 11) digitalWrite(LedBath, HIGH);
    if(lights == 12) digitalWrite(LedBath, LOW);
  }

  if(Serial2.available()){
      alarm = Serial2.read();
      if(alarm == 13)buzzer_mode = false;
      lastButtonState = 0;
  }

To distinguish between the two cases, add a logger to the place where messages arrive in your Clock Timer.

Here are 3 sample loggers ...

1 Like

How do I make a logger distinguish between the two cases? I don't understand... I'm sorry i'm quite slow...

The value 13 does not start the alert but rather stops it. bc when the value 13 is received from the app, it should tell the arduino to stop the buzzed and blinking LED's as well as clear the LCD

Show us your new blocks.

Please download and post each of those event block(s)/procedures here ...
(sample video)

1 Like

ECMS2_revised (4).aia (1.1 MB)

Here you go sir, i'm sorry again for being a nuisance :confused:

Just your Clock.Timer event block, please ...

Please download and post each of those event block(s)/procedures here ...
(sample video)

1 Like

Hello, sorry for the late reply. I was trying to test back my old project that worked but the same issues appeared where when the bluetooth is connected it'll then immediately show both button's emergency text. So i looked back at videos of the project and did everything back the way it was then figured out that my button placement was wrong. The wires of the 5v were placed at the same legs of the digital pins. So then I fixed that and everything was fine on my old project.

Then I brought it to my project now but the errors still occured, then I tried comparing the old and new project, the old project used a while test do, so I added the code and holy frick it worked!!

Here is the blocks now:

Buuuttt there is still one problem... when clicking the button in the app that should stop the alarm, yes it works but only for the app, the arduino does not receive it so the buzzer and led still buzzes and blinks unless I click on the button again, only then it'll stop

I think you are right about the logger but i'm still unsure of how to add it into the code? but here is the block for when I click the button it sends the value that should be received in the arduino to command it to stop the buzzer and leds:

I have seen this mistake on both sides of your code.

Imagine living in a household where the postman arrives once a day, and one of the other family members grabs the day's mail, picks out only the mail that interests them, and throws out the rest of the mail, bills and all.

That's what happens when you have extra reads of your BlueTooth input devoted to looking for just one value.

You have to move your Arduino code that handles 13 into the same section that handles 1-12, without any extra reads from BlueTooth.

1 Like

Can you answer this question?

Hello, could you share with me how to control the visibility of multiple arrangements because I have the same problem with Bluetooth when I use multiple screen, please

Here an example:

I did not understand yet .. I make app that have options to control fan door .. etc
and to control these I want to make multiple screen

Have you downloaded and studied the sample .aia file?
Have you understood VerticalArrangement.Visible(true/false)?

thank you