problem using revpimodio2 in separate threads
Posted: 17 Jan 2020, 10:34
i have a problem with using revpimodio2 library in multiple python codes in parallel
the output signal is not stable
i have made this simple test using the script bellow in two seperate files triggerring O_1 and O_2 in parallel
and reading the inputs wired to them I_1 and I_2 respectively and i attatched a led to O_1
and the result is that the led starts to blink when it's supposed to stay high (for 5 seconds ) and the Input that i'm reading is showing unexpected results
the output signal is not stable
i have made this simple test using the script bellow in two seperate files triggerring O_1 and O_2 in parallel
and reading the inputs wired to them I_1 and I_2 respectively and i attatched a led to O_1
and the result is that the led starts to blink when it's supposed to stay high (for 5 seconds ) and the Input that i'm reading is showing unexpected results
Code: Select all
import revpimodio2
import time
revpi = revpimodio2.RevPiModIO(autorefresh=True)
revpi.mainloop(blocking=False)
revpi.io.O_1.value=(False)
while True:
revpi.io.O_1.value=(True)
time.sleep(0.1)
print (revpi.io.I_1.value)
time.sleep(5)
revpi.io.O_1.value=(False)
time.sleep(0.1)
print (revpi.io.I_1.value)
time.sleep(5)