services | platforms | author |
---|---|---|
iot-hub |
arduino |
bb |
This repo contains the source code to help you get familiar with Azure IoT using the XK10 Iot starter kit. You will find the CW01 Get Started.
This repo contains an arduino application that runs on board the XinaBox CW01 with a xChip SW01(BME280) weather sensor, and then sends these data to your IoT hub. At the same time, this application receives Cloud-to-Device message from your IoT hub, and takes actions according to the C2D command.
Follow this page to prepare your Azure IoT hub and register your device.
- Start Arduino and open Preferences window.
- Enter
http://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas. - Open Boards Manager from
Tools > Board
menu and installesp8266 platform 2.2.0
or later - Select your ESP8266 board from
Tools > Board
menu after installation
Install the following libraries from Sketch -> Include library -> Manage libraries
AzureIoTHub
AzureIoTUtility
AzureIoTProtocol_MQTT
ArduinoJson
SW01
xCore
You can follow the image to connect your SW01 with your XinaBox CW01.
You can use the application to simulate data and send to your IoT hub.
- Open the
app/config.h
file. - Change the
SIMULATED_DATA
value fromfalse
totrue
.
Upload the app.ino
to your board.
After you successfully upload the code to your board. You will see some prompt, input your credential information according to the prompts.
You can send a C2D message to your device. You can see the device prints out the message and blinks once receiving the message.
You can send start
or stop
device method command to your xChip CW)1 to start/stop sending message to your IoT hub.