5. Connect to AWS IoT
Once everything is properly configured, you can execute the demo application in the device:
#> awsiot-sample
The device console displays information with every new update:
========================================= Updating shadow... Temperature variation greater than 1C Temperature: 44.512000C CPU Load: 0.000000% LED status: OFF =========================================
Follow these steps to control the LED:
- Log into your AWS IoT Console.
- Click Test.
- Enter # in the Subscription topic text field to subscribe to all topics.
- In Publish > Specify a topic to publish to, type $aws/things/<thing_name>/shadow/update, where <thing_name> is the thing name of your registered device.
- To switch on the LED, copy this in the text box:
- Press Publish to topic to send the message. The LED on the board switches on.
- To switch off the LED, change "ledON" : true to "ledON" : false and publish the message.
{ "state" : { "desired" : { "ledON" : true } } }
{ "state" : { "desired" : { "ledON" : false } } }