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?
Asked
Active
Viewed 165 times
1 Answers
1
Yes of course. There are several ways to do it.
- 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.
- 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.
- 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