def toggleLed(self, led): grovepi.ledBar_toggleLed(self.__pin, led)
time.sleep(.5) grovepi.ledBar_setLed(ledbar, 1, 0) time.sleep(.5) grovepi.ledBar_setLed(ledbar, 2, 0) time.sleep(.5) grovepi.ledBar_setLed(ledbar, 3, 0) time.sleep(.5) print "Test 4) Toggle a single LED" # flip a single led - if it is currently on, it will become off and vice versa # ledbar_toggleLed(ledbar, led) grovepi.ledBar_toggleLed(ledbar, 1) time.sleep(.5) grovepi.ledBar_toggleLed(ledbar, 2) time.sleep(.5) grovepi.ledBar_toggleLed(ledbar, 9) time.sleep(.5) grovepi.ledBar_toggleLed(ledbar, 10) time.sleep(.5) print "Test 5) Set state - control all leds with 10 bits" # ledbar_setBits(ledbar, state) # state: (0-1023) or (0x00-0x3FF) or (0b0000000000-0b1111111111) or (int('0000000000',2)-int('1111111111',2))
def toggleLed(self, ledValue): print "toggle LED ", ledValue grovepi.ledBar_toggleLed(self.port, ledValue) return
grovepi.ledBar_setLed(ledbar, 8, 1) time.sleep(.5) grovepi.ledBar_setLed(ledbar, 1, 0) time.sleep(.5) grovepi.ledBar_setLed(ledbar, 2, 0) time.sleep(.5) grovepi.ledBar_setLed(ledbar, 3, 0) time.sleep(.5) print "Test 4) Toggle a single LED" # flip a single led - if it is currently on, it will become off and vice versa # ledbar_toggleLed(ledbar, led) grovepi.ledBar_toggleLed(ledbar, 1) time.sleep(.5) grovepi.ledBar_toggleLed(ledbar, 2) time.sleep(.5) grovepi.ledBar_toggleLed(ledbar, 9) time.sleep(.5) grovepi.ledBar_toggleLed(ledbar, 10) time.sleep(.5) print "Test 5) Set state - control all leds with 10 bits" # ledbar_setBits(ledbar, state) # state: (0-1023) or (0x00-0x3FF) or (0b0000000000-0b1111111111) or (int('0000000000',2)-int('1111111111',2)) for i in range(0, 32):
def toggleLED(self, led=0): """ Inverts the status of the led """ grovepi.ledBar_toggleLed(self.ledbar, led)