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:

  1. Log into your AWS IoT Console.
  2. Click Test.
  3. Enter # in the Subscription topic text field to subscribe to all topics.
  4. 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.
  5. To switch on the LED, copy this in the text box:
  6. {
        "state" : {
            "desired" : {
                "ledON" : true
             }
         }
    }
  7. Press Publish to topic to send the message. The LED on the board switches on.
  8. To switch off the LED, change "ledON" : true to "ledON" : false and publish the message.
  9. {
        "state" : {
            "desired" : {
                "ledON" : false
             }
         }
    }