Multiple GPIO pins on Raspberry with

I have made a solution, that referenceses several sources for information, a file, a webpage etc. It then determins the proper state for a GPIO pin from the data, and sets it.

My problem is that the GPIO node only takes it's input from msg.payload, so I don't see any way of controlling other GPIO pins on the raspberry from the same function node, and it's a pain to do some of the same work multiple times in different function nodes.

I guess another option was to use some global variables, but as I read it around here, that is frowned upon :o)

Does anyone have any better ideas?


That is only an opinion by some, I use global, flow and context variables where they make sense. After all, if it was really a bad idea, why would it be offered??

As for the gpio nodes, you will need a separate gpio node for each pin you want to use. They are not able to be dynamically set.

Thankyou Paul :slight_smile:

Your function can set msg.gpio1, msg.gpio2 etc.
Pass the output via change nodes, which move eg msg.gpio2 to msg.payload.

Thank you :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.