X-Git-Url: http://handorf.org/code/?p=rb-clock.git;a=blobdiff_plain;f=python%2Fsw.py;fp=python%2Fsw.py;h=6c8d9a019fd504f398d04df95810ea5fd8b9b813;hp=0000000000000000000000000000000000000000;hb=d29015560feafdb91746173de224a5fe692f7b6b;hpb=f2580fcc9470d1ac688ca9b6edd87666784eaf6b diff --git a/python/sw.py b/python/sw.py new file mode 100644 index 0000000..6c8d9a0 --- /dev/null +++ b/python/sw.py @@ -0,0 +1,11 @@ +import gaugette.gpio +import gaugette.switch +SW_PIN = 13 +gpio = gaugette.gpio.GPIO() +sw = gaugette.switch.Switch(gpio, SW_PIN) +last_state = sw.get_state() +while True: + state = sw.get_state() + if state != last_state: + print "switch %d" % state + last_state = state