Hi,
i'm a new user on the RevPI Forum.
I buy the RevPi Core and RevPi DIO.
I should turn on a Led when a button is pressed.
In python on Raspberry Pi 3b+ my code was the
#SETUP PIN
GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(8, GPIO.OUT, GPIO.LOW)
#INIT VARIABLE
bool ON_OFF=False
#DEFINE FUNCTION
def ButtonPressed(channel):
if GPIO.input(7)==1:
ON_OFF=True
def ButtonReleased(channel):
if GPIO.input(7)==0:
ON_OFF=False
#DEFINE INTERRUPT EVENT
GPIO.add_event_detect(7, GPIO.RISING, callback=ButtonPressed, bouncetime=300)
GPIO.add_event_detect(7, GPIO.FALLING, callback=ButtonReleased, bouncetime=300)
#WHILE TRUE CODE
while True:
if(ON_OFF)==True:
GPIO.output(8, HIGH)
How is possible to replicate this in Revolution Pi?
How can is possible to manage Input status from python in Revolution Pi?
Thanks in advance.
Emiliano
RevPi DIO - Manage Input Pin in Python Script
Re: RevPi DIO - Manage Input Pin in Python Script
Hi have a look at this snippet here:
viewtopic.php?f=6&t=1626&p=6250&hilit=mirror#p6250
viewtopic.php?f=6&t=1626&p=6250&hilit=mirror#p6250