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.

  1. Open your Node-RED application.
  2. Open the Node-RED flow editor.
  3. Create a new tab.
  4. Drag an input ibmiot node onto the canvas.
  5. Double-click the node to configure it. Configure it as a Bluemix service that listens for a Device Event for your newly registered device.
  6. Click Done to save your changes.
  7. Add an output debug node.
  8. 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.
  9. 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.
  10. Rotate the SensorTag in any direction and note the value changes in the accelX, accelY, and accelZ values.