Receive a message from Arduino

if I receive the message 0, I want the stopwatch to start, and if I receive the message 1, I want the stopwatch to stop. I want it set up so that pressing the button again will toggle the stopwatch to start or stop. I cannot make this code work, please help me."

pls help

You have to leave the Clock Timer running (enabled), and use the contents of the global msg variable to decide what to do, regardless of whether or not this cycle received anything.

If msg = '0' then add 1 to second.Text
If second.Text >= 60 then 
  add 1 to minute.Text
  set second.Text to 00
If msg = '1' then do nothing.

Did you verify that the arduino and your app communicate properly ( asking as you did not specify )?

1 Like

When you need help for a communication between Arduino and an App, please post always both your Arduino code and the .aia so to have a look to the complete scenario.
And, as @davidefa has already said, to be sure that the comm's is working. Before putting together your app and the Arduino system, try the communication with the ready made app SerialBluetoothTerminal free on Google Playstore.

For examples, codes, and troubleshooting please spend also a moment to get a reading of:
https://community.appinventor.mit.edu/t/faq-section-bluetooth-starter-guides/1674:

Best wishes