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