A button that does something
Revision as of 15:42, 3 November 2016 by Oyo (talk | contribs) (Created page with "So how about wiring a button input that is able to trigger an output? We need something like this File:Button breadboard.png and some code to run ( this example is ju...")
So how about wiring a button input that is able to trigger an output?
We need something like this
and some code to run ( this example is just starting another code )
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import os
import subprocess
GPIO.setmode(GPIO.BCM)
# setup pin 23 as an intput
GPIO.setup(23,GPIO.IN)
GPIO.add_event_detect(23, GPIO.RISING, bouncetime=800)
while True:
if GPIO.event_detected(23):
print 'click'
os.popen("python /root/Desktop/anothercode.py")
GPIO.cleanup()