Created
January 27, 2017 12:20
-
-
Save xerp/97bcd92c648e910068932574dfabcb83 to your computer and use it in GitHub Desktop.
Python script using RF433Utils to send codes
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 RPi.GPIO as GPIO | |
import subprocess | |
LED_PIN=19 | |
PUSH_PIN=5 | |
CODE='117989504' | |
RF_COMMAND='/home/pi/projects/433Utils/RPi_utils/codesend' | |
def setup(): | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setwarnings(False) | |
GPIO.setup(PUSH_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP) | |
GPIO.setup(LED_PIN, GPIO.OUT) | |
def loop(): | |
count = 1 | |
while True: | |
if not GPIO.input(PUSH_PIN): | |
#Button pressed | |
GPIO.output(LED_PIN, GPIO.HIGH) | |
print count | |
subprocess.call([RF_COMMAND, CODE]) | |
count +=1 | |
else: | |
GPIO.output(LED_PIN, GPIO.LOW) | |
if __name__ == '__main__': | |
setup() | |
loop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment