0

can you use a toggle button to display on and off based off the messages that it will receive from an arduino. How would you code this?

A. Sam
  • 1
  • 1

1 Answers1

1

Yes of course. There are several ways to do it.

  1. The first one is using a simple HTTP server on Android and make arduino making a simple HTTP request. Then in your android app you could parse the message and set the toggle button status.
  2. The second method (i think more "elegant") is using MQTT protocol and register a channel where arduino sends messages to Android. If you want to know more about MQTT protocol you can read my post that covers it.
  3. The third is polling arduino status message, in this case you can use aRest library. To know how to use it give a look at my post.

Hope it will help you! Let me know if you need more information

FrancescoAzzola
  • 2,666
  • 2
  • 15
  • 22