Commit 69be7a17 authored by Giacomo Lavermicocca's avatar Giacomo Lavermicocca

add try except

parent 641ee200
# This file is executed on every boot (including wake-boot from deepsleep)
import esp
esp.osdebug(None)
import gc
gc.collect()
#import ccalendar
#ccalendar.getEvents("")
import cconnect
try:
cconnect.do_connect()
except Exception as e:
print("Error found in boot.py" + str(e))
import uurequests
import time
import machine
import network
import gc
def getEvents(param):
led = machine.Pin(2, machine.Pin.OUT)
sta_if = network.WLAN(network.STA_IF)
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)
while True:
text = "No events yet..."
if sta_if.isconnected() == True:
print("NEW REQUEST")
print(sta_if.ifconfig())
r = uurequests.get("https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec")
print(r.text)
text = r.text
else:
import cconnect
cconnect.make_connect()
print("NEW REQUEST AFTER RECONNECT")
r = uurequests.get("https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec")
print(r.text)
text = r.text
for i in range(120):
print("FreeMem" + str(gc.mem_free()))
led.on()
time.sleep(1)
led.off()
time.sleep(1)
print(text)
print("Welcome to calendar eventsssss")
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment