Using array nodes¶
A simple array is defined with a sine signal wave. The scenario is to filter and map values.
Objective¶
To filter the elements which are greater than 0 from an array and map them by adding an added value of 100. Also, it is required to display the sine wave generated in the message payload.
Procedure¶
To connect the array node with the signal wave, follow these steps:
-
From the node palette, drag and drop the following nodes from the respective palette to the working area:
- Inject node
- Generate node
- Filter node
- Map node
- Debug node
Connect the nodes in a flow as shown below:
-
Double click on "inject" node to edit the properties. For more information, refer to Editing nodes.
-
Double click on "generate" node to edit the properties.
- Enter the "Name".
- In the "Mode" section, you can select any one of the options from the dropdown menu.
- In the "Period" section, you can select any one of the options from the dropdown menu.
- In the "Basis unit" section, you can select any one of the options from the dropdown menu.
- To add the signal, click
.
-
Click "Done".
- Enter the "Name".
-
Double click on "filter" node to edit the properties.
- Enter the "Name".
- Enter the "Filter function".
-
Click "Done".
- Enter the "Name".
-
Double click on "map" node to edit the properties.
- Enter the "Name".
- Enter the code in the "Map function".
- Check the box "Multiline function body", if required.
-
Click "Done".
- Enter the "Name".
-
Save and execute the flow.
The values are mapped in the objects and the necessary sine wave has also been generated in the message payload: