Ubidots Community

GET, POST Arduino

I am writing a small project to acquire cloud data from Arduino and switch LEDs. How can I do both in the same code? At this moment, if I want to turn on an LED I have to wait for the publication time of the temperature data and then the LED turns on.

Hey @marcasTech,

For such control applications where you’d like to detach the data publish and subscription to the cloud into 2 independent process, the best approach it connecting your device over MQTT, a pub/sub protocol that will allow you to receive (subscribe) data from the cloud as soon as it becomes available while sending (publishing) your temperature readings “at the same time” (almost at the same time).

Please visit our Hardware Docs for additional information, explanation and examples about MQTT.

–David