def digital_write(self, data): try: grovepi.pinMode(self.pin, 'OUTPUT') grovepi.digitalWrite(self.pin, data) except IOError: pass
def trigger_grove_led(sensor_id, action): print(('led get action:' + action.name)) if action.name == 'on': grovepi.digitalWrite(led, 1) else: grovepi.digitalWrite(led, 0)
def on(self): grovepi.digitalWrite(self.pin,1)
def off(self): grovepi.digitalWrite(self.pin,0)
def blink(self): grovepi.digitalWrite(self.pin,1) time.sleep(BLINK_DURATION) grovepi.digitalWrite(self.pin,0)
def off(self): grovepi.digitalWrite(self.pin, 0)
def on(self): grovepi.digitalWrite(self.pin, 1)
def blink(self): grovepi.digitalWrite(self.pin, 1) time.sleep(BLINK_DURATION) grovepi.digitalWrite(self.pin, 0)
def trigger_grove_led(sensor_id, action): print('led get action:' + action.name) if action.name == 'on': grovepi.digitalWrite(led, 1) else: grovepi.digitalWrite(led, 0)