5. Listen for events by using a Node-RED application
In this section, you construct a Node-RED flow that allows you to listen in to and interpret the SensorTag events.
- Open your Node-RED application.
- Open the Node-RED flow editor.
- Create a new tab.
- Drag an input ibmiot node onto the canvas.
- Double-click the node to configure it. Configure it as a Bluemix service that listens for a Device Event for your newly registered device.
- Click Done to save your changes.
- Add an output debug node.
- Wire the nodes together. Then, deploy your flow.
The IBM IoT node (ibmiot) should show a status of connected.The debug pane now shows the events coming from the device.
- Make sure that your SensorTag is broadcasting through the application that is running on your mobile device. If it’s not broadcasting, try restarting the mobile device.
- Rotate the SensorTag in any direction and note the value changes in the accelX, accelY, and accelZ values.