Created
December 3, 2018 13:09
-
-
Save henriklied/8c6ce5c008e60556fbf9ce01db652fd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time, os | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setwarnings(False) | |
GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) | |
is_pushed = False | |
def button_callback(channel): | |
global is_pushed | |
if GPIO.input(10) and not is_pushed: | |
is_pushed = True | |
os.system('sudo python /home/pi/rf.py -f 433950000 -b 2000 -l 8 -r 1') | |
time.sleep(3) | |
os.system('sudo python /home/pi/rf.py -f 433950000 -b 2000 -l 10 -r 1') | |
time.sleep(3) | |
os.system('sudo python /home/pi/rf.py -f 433950000 -b 2000 -l 12 -r 1') | |
time.sleep(3) | |
os.system('sudo python /home/pi/rf.py -f 433950000 -b 4000 -l 8 -r 1') | |
time.sleep(3) | |
os.system('sudo python /home/pi/rf.py -f 433950000 -b 4000 -l 10 -r 1') | |
time.sleep(3) | |
os.system('sudo python /home/pi/rf.py -f 433950000 -b 4000 -l 12 -r 1') | |
time.sleep(3) | |
for f in [9,7,5,2]: | |
for b in [2]: | |
for l in [8,10,12]: | |
os.system("sudo python /home/pi/rf.py -f 433%d50000 -b %d000 -l %d -r 5" % (f,b,l)) | |
print("Button was pushed", channel) | |
is_pushed = False | |
GPIO.add_event_detect(10,GPIO.BOTH,callback=button_callback) | |
while True: | |
time.sleep(1) | |
GPIO.cleanup() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment