Your shopping cart is empty!
![IRIV PiControl - Node-RED Digital Input and Output IRIV PiControl - Node-RED Digital Input and Output](https://static.cytron.io/image/tutorial/iriv-picontrol-node-red-digital-input-and-output/digtial-in-and-out-iriv-picontrol-large.jpeg)
IRIV PiControl - Node-RED Digital Input and Output
- Abdulrahman Alhamed
- 17 Feb 2024
- Tutorial
- 420
In this tutorial, we will learn about digital input and output by exploring how to integrate GPIO nodes into our flow within Node-RED on our IRIV PiControl setup.
Before we begin, make sure you have Node-RED installed on your IRIV. If you haven't already installed it, you can follow this guide here.
Digital Output
First, let's start with the digital output, add the GPIO Out node to our flow. You can find it in the palette on the left-hand side of the screen. Simply drag and drop it onto the workspace.
Double-click on it to open its configuration panel. Here, you can specify which pin it's connected to and whether it's set to output high or low. You can have a look at IRIV's datasheet, where you'll find a block diagram indicating the corresponding pins.
Let’s select GPIO 20, as it’s the LED0 pin on our IRIV.
Now let's add two inject nodes to our flow. These nodes will allow us to toggle the state of the LED.
Configure the first inject node to send '1' when clicked, and the second inject node to send a '0' when clicked.
With everything set up, let's test the flow. Deploy your changes, and observe how clicking the inject nodes toggles the state of the LED.
Digital Input
Great! Now that we've seen how digital output works, let's move on to digital input.
To set up digital input, we'll use the GPIO In node. Let's add it to our flow.
Double-click on it to open its configuration panel. Let’s select GPIO 4, as it’s the User Button pin on our IRIV PiControl.
Now, let's add GPIO Out node to our flow and assign its pin to GPIO19 as it’s the buzzer on IRIV.
So now, we want the Buzzer on the IRIV to respond by sounding up when the User Button is pressed, and to do that we will add a Trigger Node between them.
Let's test the flow. Deploy your changes, and observe how pressing the button triggers the buzzer.
Great! Now you've learned how to set up digital input and output using Node-RED on your IRIV PiControl. Stay tuned for more tutorials.
Hardware Components
IRIV PiControl - IR4.0 CM4 Industrial Controller
S$420.00++ S$420.00