import machine
from machine import Pin
from machine import sleep
def print_wakeup_reason():
reason = machine.wake_reason()
reset_reason = machine.reset_cause()
print(dir(machine))
if reason == machine.EXT0_WAKE:
print("EXT0")
elif reason == machine.EXT1_WAKE:
print("EXT1")
elif reason == machine.TIMER_WAKE:
print("TIMER")
elif reason == machine.TOUCHPAD_WAKE:
print("TOUCHPAD")
else:
print("Wakeup was not caused by deep sleep: %s\n" % reason)
print("Reset Cause: %s\n" % reset_reason)
"""
elif reason == machine.RTC_WAKE:
print("Wakeup was not caused by deep sleep: %s\n" % reason)
if reason == machine.WLAN_WAKE:
print("Wakeup caused by WLAN\n")
elif reason == machine.PIN_WAKE:
print("Wakeup caused by pin\n")
elif reason == machine.machine.RTC_WAKE:
print("Wakeup caused by rtc\n")
else:
print("Wakeup was not caused by deep sleep: %s\n" % reason)
"""
return
bootCount = 0
# Setup
print("Going to sleep now")
print_wakeup_reason()
if machine.reset_cause() == machine.DEEPSLEEP_RESET:
print('woke from a deep sleep')
#machine.deepsleep(1000)
print("HOLa")
#while True:
# pass