I recently started working with a RevPi core 3+ 16G with a python project but i'm encountering a strange problem.
I'm trying to use the LED A1 and A2 on the RevPi ad debug LED for the script but both led seems to act funny, they blink, basicali when they should stay on or off.
It's hard to explain so i include a video and the actual script being run.
Video: https://youtu.be/jHbEJjsMeEs
Code:
Code: Select all
import revpimodio2
import time
rpi = revpimodio2.RevPiModIO(autorefresh=True)
def setVPNLink( str ):
rpi = revpimodio2.RevPiModIO(autorefresh=True)
if str == "off":
rpi.core.a1green.value = False
rpi.core.a1red.value = False
print(1)
elif str == "verde":
rpi.core.a1green.value = True
rpi.core.a1red.value = False
print(2)
elif str == "arancio":
rpi.core.a1green.value = True
rpi.core.a1red.value = True
print(3)
elif str == "rosso":
rpi.core.a1green.value = False
rpi.core.a1red.value = True
print(4)
elif str == "clear":
rpi.core.a1green.value = False
rpi.core.a1red.value = False
print(5)
return
def setRunningLED( str ):
rpi = revpimodio2.RevPiModIO(autorefresh=True)
if str == "off":
rpi.core.a2green.value = False
rpi.core.a2red.value = False
print(6)
elif str == "verde":
rpi.core.a2green.value = True
rpi.core.a2red.value = False
print(7)
elif str == "arancio":
rpi.core.a2green.value = True
rpi.core.a2red.value = True
print(8)
elif str == "rosso":
rpi.core.a2green.value = False
rpi.core.a2red.value = True
print(9)
elif str == "clear":
rpi.core.a2green.value = False
rpi.core.a2red.value = False
print(10)
return
setRunningLED("clear")
setVPNLink("clear")
time.sleep(5)
setVPNLink("clear")
time.sleep(5)
setVPNLink("verde")
time.sleep(5)
setVPNLink("arancio")
time.sleep(5)
setVPNLink("rosso")
time.sleep(5)
setVPNLink("verde")
time.sleep(5)
setRunningLED("clear")
setVPNLink("clear")