예제 #1
0
#the following lines will allow you to use buttons and leds
import btnlib as btn
import ledlib as led
import time

#the led.startup() function cycles through the leds
led.startup()
time.sleep(1)

print("All on and off")
#to turn on all leds, use the led.turn_on_all(2) function:
led.turn_on_all()
time.sleep(2)
#to turn off all:
led.turn_off_all()
time.sleep(1)

print("Red on and off")
#to turn on a single led, use a command like this:
led.turn_on(led.red)
#your choices for leds are led.red, led.yellow, led.green, led.blue
time.sleep(2)
#to turn it off:
led.turn_off(led.red)
time.sleep(1)

print("Yellow with isOn test")
#the led.isOn(led) function tells you if a particular led is currently on
if led.isOn(led.yellow):
  print("Yellow is on")
else :
예제 #2
0
파일: main.py 프로젝트: traceyt/ubtech
#the following lines will allow you to use buttons and leds
import btnlib as btn
import ledlib as led
import time

led.startup()

while btn.isOn(btn.switch) :
  #put your code here

print "Goodbye"
btn.GPIO.cleanup()