Skip to content

Instantly share code, notes, and snippets.

@valbeat
Last active August 29, 2015 14:27
Show Gist options
  • Save valbeat/794e6d2fbe6e2bc288ce to your computer and use it in GitHub Desktop.
Save valbeat/794e6d2fbe6e2bc288ce to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import wiringpi2
from time import sleep
import subprocess
# IO
OUTPUT = 1
INPUT = 0
HIGH = 1
LOW = 0
# pin number
BUTTON1 = 2
BUTTON2 = 3
BUTTON3 = 4
io = wiringpi2
io.wiringPiSetupGpio()
io.pinMode(BUTTON1,INPUT)
io.pinMode(BUTTON2,INPUT)
io.pinMode(BUTTON3,INPUT)
while 1:
if io.digitalRead(BUTTON1) == 0 :
print "play"
if io.digitalRead(BUTTON2) == 0 :
print "stop"
if io.digitalRead(BUTTON3) == 0 :
print "other"
sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment