Hi,
Im trying to control the level in a tank with node red on the raspberry pi 3. I have a low and high switch at the bottem and top of the tank and a solenooid to let in water. Im very new to coding and node red so i need some help. Ive done up a flow (I know its ugly) and it kind of works but, if the high switch is open before the low switch opens the solenoid still fills the tank.
[{“id”:“8757536f.2115c8”,“type”:“rpi-gpio in”,“z”:“e4167a44.5763d8”,“name”:“Low Level SW”,“pin”:“40”,“intype”:“up”,“debounce”:“25”,“read”:true,“x”:130,“y”:580,“wires”:[[“26fd1d82.81ceb2”,“580f2422.bc118c”,“42c5da7c.9a4054”,“a1c56cf5.c4674”,“e0876d8c.a7238”]]},{“id”:“ca05192d.5c77b8”,“type”:“rpi-gpio in”,“z”:“e4167a44.5763d8”,“name”:“High level SW”,“pin”:“38”,“intype”:“up”,“debounce”:“25”,“read”:true,“x”:130,“y”:520,“wires”:[[“39d1f00e.2be2b”]]},{“id”:“ec6b2cda.ba1df”,“type”:“rpi-gpio out”,“z”:“e4167a44.5763d8”,“name”:“Solenoid”,“pin”:“37”,“set”:true,“level”:“1”,“freq”:"",“out”:“out”,“x”:800,“y”:580,“wires”:},{“id”:“9138080f.2f1f28”,“type”:“change”,“z”:“e4167a44.5763d8”,“name”:“AND”,“rules”:[{“t”:“change”,“p”:“payload”,“pt”:“msg”,“from”:“0”,“fromt”:“num”,“to”:“0”,“tot”:“num”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:610,“y”:580,“wires”:[[“ec6b2cda.ba1df”]]},{“id”:“e0876d8c.a7238”,“type”:“trigger”,“z”:“e4167a44.5763d8”,“op1”:“1”,“op2”:“1”,“op1type”:“num”,“op2type”:“num”,“duration”:“250”,“extend”:false,“units”:“ms”,“reset”:"",“bytopic”:“all”,“name”:"",“x”:420,“y”:580,“wires”:[[“9138080f.2f1f28”]]},{“id”:“39d1f00e.2be2b”,“type”:“change”,“z”:“e4167a44.5763d8”,“name”:“Invert output”,“rules”:[{“t”:“change”,“p”:“payload”,“pt”:“msg”,“from”:“1”,“fromt”:“num”,“to”:“0”,“tot”:“num”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:410,“y”:520,“wires”:[[“9138080f.2f1f28”]]}]
This is what i need it to do,
if high switch = 0 & low switch = 0
send = 0
if high switch = 1 & low switch = 0
send = 0
if high switch = 1 & low switch = 1
send = 0
if high switch = 0 & low switch = 1
send = 1, untill high switch = 1
Ive used the trigger node to latch the low switch output to 1 untill the high switch sends 0. I think it can be done in a function node but i dont know how to seperate the 2 switch payloads coming in to the function node
Any help wil be appreciated
Jeremy