Compact DO not working as expected
Posted: 20 Sep 2021, 14:04
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")
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")