Code: Select all
import pyb
rtc = pyb.RTC()
rtc.datetime((2015, 8, 6, 4, 13, 0, 0, 0)) # ensure it's initialised (?)
usb_connected = pyb.Pin.board.USB_VBUS.value() == 1
def lpdelay(ms):
rtc.wakeup(ms)
pyb.stop()
rtc.wakeup(None)
if not usb_connected:
led = pyb.LED(4)
while True:
led.on()
pyb.delay(1000) # use pyb version to keep weirdness in one place
led.off()
# pyb.delay(1)
lpdelay(5000)