pimoroni / automation-hat

Python library and examples for the Pimoroni Automation HAT, pHAT and HAT Mini
https://shop.pimoroni.com/products/automation-hat
MIT License
121 stars 42 forks source link

relay integer references #60

Open cryptz2k opened 3 months ago

cryptz2k commented 3 months ago

are relays accessible by integer value or by name/word only.

for example:

is: automationhat.relay[i + 1].on() supported in a for loop?

or must you spell out the name such as

automationhat.relay.one.toggle()

Gadgetoid commented 3 months ago

Yes, there's an explicit case in the deep magic that makes this whacky code work. It should handle addressing relays as a collection.

An example of this might be a good idea in retrospect!