Commit 8ec01514 authored by Giacomo Lavermicocca's avatar Giacomo Lavermicocca
Browse files

print - graphical enhacement

parent 7805f12b
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -12,5 +12,6 @@ import cconnect
try:
    cconnect.do_connect()
except Exception as e:
    print("Error found in boot.py" + str(e))
    print("Error found in boot.py {0}".format(e))
    import machine
    machine.reset()
+37 −28
Original line number Diff line number Diff line
@@ -4,7 +4,12 @@ import machine
import network
import gc

URL_SCRIPT = "https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec"

print("Welcome to calendar events!!!")

def getEvents(param):
    try:
        led = machine.Pin(2, machine.Pin.OUT)
        sta_if = network.WLAN(network.STA_IF)
        ap_if = network.WLAN(network.AP_IF)
@@ -16,23 +21,27 @@ def getEvents(param):
            if sta_if.isconnected() == True:
                print("NEW REQUEST")
                print(sta_if.ifconfig())
            r = uurequests.get("https://script.google.com/macros/s/AKfycbyz55y8cdFmtX31yiOOuPn5SLGdGOuL6KvPOorfZZEmvzUppo0/exec")
                r = uurequests.get(URL_SCRIPT)
                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")
                r = uurequests.get(URL_SCRIPT)
                print(r.text)
                text = r.text
        for i in range(120):
            print("FreeMem" + str(gc.mem_free()))
            led.on()
            time.sleep(1)
            for i in range(30):
                print(".", end='')
                if not text:
                    led.off()
                else:
                    led.on()      
                time.sleep(1)
            print(text)
    except Exception as e:
        print("Error found in boot.py {0}".format(e))
        import sys
        print("Stacktrace -> {0}".format(sys.print_exception(e)))
        machine.reset()
        
print("Welcome to calendar eventsssss")
+18 −9
Original line number Diff line number Diff line
def do_connect():
import network

def make_connect():
    print("No connecttion to router")
    sta_if = network.WLAN(network.STA_IF)
    if not sta_if.isconnected():
       print('connecting to network...')
       sta_if.active(True)
        sta_if.connect('ssids', 'password')
       sta_if.connect('Thomas', 'viapiccardi47!!thomas')
       while not sta_if.isconnected():
         pass
       print('network config:', sta_if.ifconfig())


def do_connect():
    make_connect()

    import webrepl
    webrepl.start()
    import ccalendar
    ccalendar.getEvents("")
 No newline at end of file