Page 1 of 1

Compact DO not working as expected

Posted: 20 Sep 2021, 14:04
by roger.gent
Hi,

I aim to use a Compact to control MOSFET power switches using Python and revpimodio2. . As I am new to the Rev PI I wrote simple test code to understand how to use the IO. It seemed to work. However, While I can turn on the DO from a script, it no lnger seems to turn off. So I ran my early test script (blink). _ and DO1 turns ON, but not off. If i cerater two python scripts, one to turn DO1 on and one to turn it off, and run from the command line it works fine. Do the same in the blink test with a 2 second delay and the DO stays on. What am I doing wrong?

import revpimodio2
from time import sleep
rpi = revpimodio2.RevPiModIO(autorefresh=True)
rpi.io.DOutBit_1.value=True
print("on")
sleep(2)
rpi.io.DOutBit_1.value=False
print("off")

Re: Compact DO not working as expected

Posted: 06 Oct 2021, 16:58
by dirk
Hello first of all thank you for your request. Unfortunately I can't give support for a 3rd party component like RevPiModIO.
A suggestion - make a simple test to check what happens when switching on and off with the following command:

Code: Select all

piTest -w DOutBit_1,1
piTest -w DOutBit_1,0

Re: Compact DO not working as expected

Posted: 06 Oct 2021, 19:10
by roger.gent
My mistake, I assumed revpimodio2 was a Kunbus product. The DO sensors work fine using pi test, and even stand alone controls using revpimodio2. What is even more worrying, is my code now works fine (unchanged), switching on an off as requested by the software. There was obviously a hang up somewhere but it did not work on several occasions, days apart. It is now working in my intended code, and has been for several (different) days. Most strange.

If you cannot check what revpimodio2 was doing then I guess you cannot help me any further - I will now seek out the authors and ask them to investigate/comment. What you suggested to try was the very first test I did with my brand new compact! - and it all worked fine.

Best regards

Roger

Re: Compact DO not working as expected

Posted: 07 Oct 2021, 08:48
by nicolaiB
Hi Roger

You can ask revpimodio2 related questions in the subforum of our makers corner: https://revolutionpi.de/forum/viewforum.php?f=41. Sven (the author of the library) frequently reads there and tries to answer the questions.

Nicolai