Then add some inject nodes, switch, and GPIO out nodes and connect them as follows.
Click on the switch node and enter the on signal as 0.
Repeat the same step with the signal as 1 in another node. Then click on the Raspberry Pi out node and select the pin. In my case, I'm using GPIO 19.
Here is the complete JSON of my flow I have added two led's on the Raspberry.[
{
"id": "5bdf6461ffad327a",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "bcccd9aac1596b24",
"type": "rpi-gpio out",
"z": "5bdf6461ffad327a",
"name": "",
"pin": "26",
"set": "",
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 720,
"y": 380,
"wires": []
},
{
"id": "034c6ccdd7eccd7f",
"type": "switch",
"z": "5bdf6461ffad327a",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 510,
"y": 340,
"wires": [
[
"bcccd9aac1596b24",
"93780305db7d14f0"
]
]
},
{
"id": "72c0d7a9a642486d",
"type": "inject",
"z": "5bdf6461ffad327a",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "false",
"payloadType": "bool",
"x": 310,
"y": 500,
"wires": [
[
"5bc162fcf714ce93"
]
]
},
{
"id": "925d9a563c4b4e8d",
"type": "rpi-gpio out",
"z": "5bdf6461ffad327a",
"name": "",
"pin": "26",
"set": "",
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 720,
"y": 460,
"wires": []
},
{
"id": "5bc162fcf714ce93",
"type": "switch",
"z": "5bdf6461ffad327a",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 510,
"y": 500,
"wires": [
[
"925d9a563c4b4e8d",
"08fe29effb029c40"
]
]
},
{
"id": "ac5d41eb38bc759a",
"type": "inject",
"z": "5bdf6461ffad327a",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 310,
"y": 340,
"wires": [
[
"034c6ccdd7eccd7f"
]
]
},
{
"id": "93780305db7d14f0",
"type": "rpi-gpio out",
"z": "5bdf6461ffad327a",
"name": "",
"pin": "19",
"set": "",
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 720,
"y": 320,
"wires": []
},
{
"id": "08fe29effb029c40",
"type": "rpi-gpio out",
"z": "5bdf6461ffad327a",
"name": "",
"pin": "19",
"set": "",
"level": "0",
"freq": "",
"out": "out",
"bcm": true,
"x": 720,
"y": 520,
"wires": []
}
]
If you inject the true node both LEDs will turn on if you inject the false node both LEDs will turn off