problem using revpimodio2 in separate threads

Topics about the Hardware of Revolution Pi
Post Reply
sofiene
Posts: 21
Joined: 24 Dec 2019, 15:36
Answers: 0

problem using revpimodio2 in separate threads

Post by sofiene »

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

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)
    
here's a video showing the problem i'm facing

https://addixo-my.sharepoint.com/:v:/p/ ... w?e=4fKvKm
Online
User avatar
nicolaiB
KUNBUS
Posts: 878
Joined: 21 Jun 2018, 10:33
Answers: 8
Location: Berlin
Contact:

Re: problem using revpimodio2 in separate threads

Post by nicolaiB »

Post Reply