def blink(self, millis): if self._interval: self._interval.clear() self._interval = setInterval(self.toggle, millis)
def blink(self, millis): self._interval = setInterval(self.toggle, millis)
from time import sleep board = Arduino() buzzer = Buzzer(board, "8") sensor = Sensor(board, "A0") def loop(): value = sensor.value or 1 # value is initially None value = value / 2 buzzer.on() sleep(value) buzzer.off() sleep(value) setInterval(loop, 0) # Run an interactive shell so you can play (not required) import code code.InteractiveConsole(locals=globals()).interact() ########NEW FILE######## __FILENAME__ = led #! /usr/bin/env python """ This is an example that demonstrates how to blink an led using BreakfastSerial. It assumes you have an led wired up to pin 13. """ from BreakfastSerial import Led, Arduino
board = Arduino() buzzer = Buzzer(board, "8") sensor = Sensor(board, "A0") def loop(): value = sensor.value or 1 # value is initially None value = value / 2 buzzer.on() sleep(value) buzzer.off() sleep(value) setInterval(loop, 0) # Run an interactive shell so you can play (not required) import code code.InteractiveConsole(locals=globals()).interact() ########NEW FILE######## __FILENAME__ = led #! /usr/bin/env python """ This is an example that demonstrates how to blink an led using BreakfastSerial. It assumes you have an led wired up to pin 13. """ from BreakfastSerial import Led, Arduino