Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Shared access to IO class

1462 Views - Created 19/07/2019

19/07/2019

Posted by:
mikeb

mikeb Avatar

Hi,

I am using my Raspberry Pi to run my heating and solar and I use the expander Pi to control a set of 20 relays.I have a python daemon that runs 24/7 controling the relays and all is working fine.

However, whilst the daemon was running I ran another python script to test some new functionality. The next day I found the Hot water system didn't kick in because, it seems, I had stolen the connection to the Expander IO interface. No error was detected and the relays failed to fire but the daemon continued as if everything was ok.

This is not a major issue, now I think I understand what happened, but is there a way I can tell the communication has failed. I possibly could check the state of the relay after setting it on but it would be nice to know if there is a correct method to solve this issue. I presume if I call ExpanderPi.IO() again and get a new instance of the class I could re-establish connection.

Any advice would be very useful.

Mike

20/07/2019

Posted by:
mikeb

mikeb Avatar

Think I can answer my own question. When using the IO class from the adhoc script I need to specify reset = false

iobus = ExpanderPi.IO(reset=False)

otherwise the ports are set to input.

Silly me.

Mike

Sign in to post your reply

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.