2018-09-03 03:22:11 -07:00
|
|
|
import time
|
|
|
|
|
2018-09-02 20:06:53 -07:00
|
|
|
import board
|
|
|
|
import digitalio
|
|
|
|
|
|
|
|
|
2018-09-03 15:20:27 -07:00
|
|
|
def feather_red_led_flash(duration=10, rate=0.5):
|
2018-09-02 20:06:53 -07:00
|
|
|
'''
|
2018-09-03 15:20:27 -07:00
|
|
|
Flash the red LED for $duration seconds, alternating every $rate
|
2018-09-02 20:06:53 -07:00
|
|
|
'''
|
|
|
|
|
|
|
|
rled = digitalio.DigitalInOut(board.LED1)
|
|
|
|
rled.direction = digitalio.Direction.OUTPUT
|
|
|
|
|
2018-09-03 15:20:27 -07:00
|
|
|
for cycle in range(duration / rate):
|
2018-09-02 20:06:53 -07:00
|
|
|
rled.value = cycle % 2
|
|
|
|
time.sleep(rate)
|