0Pricing
Arduino & IoT Academy · Lesson

Subscribe & Act on Commands

Toggle a relay when a message arrives.

Listening for Messages

Publishing sends data out; subscribing lets your device receive it. This is how the cloud sends commands back to hardware.

Subscribe to a Topic

Tell the broker which topic you want with subscribe. From then on, matching messages are pushed straight to your device.

client.subscribe("home/livingroom/light");

All lessons in this course

  1. Why MQTT Fits IoT
  2. Connect to a Broker
  3. Publish Sensor Topics
  4. Subscribe & Act on Commands
← Back to Arduino & IoT Academy