How to receive a number from arduino?

Hello!

Below I have posted a simple program I made.
I want the app to display a big "Warning" message (with sound if it's not too difficult) when it receives a 0 (zero) from the bluetooth on the Arduino.

I am not good with programming so apologies for the simple questions.

Here examples:

1 Like

I checked, some of them kind of do what I want but they are more complicated than my program so I have no idea how to implement them.

What code do you use to send a "0" from the Arduino to the App?
When should Arduino send a "0"?

1 Like

Here is a simple BlueTooth text receiver sample, for single value per line:
blocks
initialize global message to


1 Like

Below is a snippet of the code. Basically when a magnetic sensor is of high value, I want to buzz the alarm and send a "0" to the app.

if (MagneticBuzzerState == HIGH && previousMagneticBuzzerState == LOW) {
tone(Buzzer, 400);
delay(500);
bluetoothSerial.println("0");}
else if (MagneticBuzzerState == LOW && previousMagneticBuzzerState == HIGH) {
noTone(Buzzer);}

This worked, even though I don't understand any of it. :laughing:
I finally got the message I wanted. Now I just need to find out how to add a sound and maybe open a new screen when the message is received. Thanks a bunch!

Don't use multiple screens with BlueTooth.

Stay in the current screen and expose different Vertical Arrangements instead, to not lose the connection.

1 Like

I see. Wouldn't consider that a possible issue. Thanks again!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.