Overview

In the first example, we saw how to configure the groov I/O device and then read from a memory map address just to see that everything was working correctly.

Read an I/O Value

The Read node is mostly used for reading the current value of an analog or digital channel, either an input or an output.

Using a module of your choosing, configure a Read node to read the current value of a channel.

  1. Double-click on an existing (or new) groov I/O Read node to open the “Edit groov i/o read node” view.
  2. For the Device field, confirm that a configured device is selected.
  3. For the Data Type field, select either Digital Channel or Analog Channel.
  4. For the Module Index, enter the module location you’d like to use. The indexes are zero-based, so 0 is for the first slot on the chassis.
  5. For the Channel Index, enter the channel you’d like to use. The indexes are zero-based, so 0 is for the first channel on the module.
  6. Click Done.
  7. Click Deploy.
  8. Make sure the Debug tab is open in the right-hand sidebar.
  9. Click the Inject node’s button.

In the Debug tab, you should see messages with the channel’s current value.

For example, here’s a flow reading both a digital and analog value, with the values shown in the Debug tab: Read a channel value

Accessing Additional Info in the Response

When reading a channel’s value, the main value is placed in the msg.payload property. Additional information is placed in the msg.body property.

To see the full message: 1. Open the Debug node and change the Output field from msg.payload to complete msg object. 1. Redploy the flow and click the associated Inject node. 1. In the Debug tab, expand the message to see the msg.body property and all the other values.

Read a channel value

Next Step

Continue on to scanning values with the Input node.