Compact DO not working as expected

Topics about the Software of Revolution Pi
Post Reply
roger.gent
Posts: 2
Joined: 23 Aug 2021, 17:40
Answers: 0

Compact DO not working as expected

Post 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")
User avatar
dirk
KUNBUS
Posts: 1926
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Compact DO not working as expected

Post 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
roger.gent
Posts: 2
Joined: 23 Aug 2021, 17:40
Answers: 0

Re: Compact DO not working as expected

Post 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
User avatar
nicolaiB
KUNBUS
Posts: 869
Joined: 21 Jun 2018, 10:33
Answers: 7
Location: Berlin
Contact:

Re: Compact DO not working as expected

Post 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
Post Reply