# This file is executed on every boot (including wake-boot from deepsleep) #import esp #esp.osdebug(None) import webrepl webrepl.start() import wifiConnect #wifiConnect.connect('TIM-37482183', 'HnbD76SPtLs7G8vS') #if network not found start Access Point mode wifiConnect.connect('RedmiMau', 'mau12397') #if network not found start Access Point mode import machine import os try: uos.mount(machine.SDCard(), "/sd") os.chdir("sd") except: print("could not mount SD card")
# This file is executed on every boot (including wake-boot from deepsleep) #import esp #esp.osdebug(None) import webrepl webrepl.start() import wifiConnect wifiConnect.connect( 'TIM-37482183', 'HnbD76SPtLs7G8vS') #if network not found start Access Point mode import machine import os try: uos.mount(machine.SDCard(), "/sd") os.chdir("sd") except: print("could not mount SD card")
import pcd8544 import framebuf import utime import machine import _thread import wifiConnect from machine import Pin, SPI wifiConnect.connect() #set ntp time from ntptime import settime settime() def getDateTime(): t = utime.localtime() y, m, d, h, mi, s = t[0], t[1], t[2], t[3], t[4], t[5] y = str(y) if (m < 10): m = "0" + str(m) else: m = str(m) if (d < 10): d = "0" + str(d) else: d = str(d)
import picoweb import wifiConnect from machine import UART ip = wifiConnect.connect() uart = UART(2, 9600) # init with given baudrate uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters app = picoweb.WebApp(__name__) def sendData(data): uart.write(data) #Change the HTTP endpoint in accordance with your group ID @app.route("/red/2") def red(req, resp): #Here your code sendData("20") # You can change the message yield from picoweb.start_response(resp, content_type="text/html") yield from resp.awrite("Sending Red") yield from resp.aclose() @app.route("/green/2") def green(req, resp): #Here your code sendData("21") yield from picoweb.start_response(resp, content_type="text/html")
from wifiConnect import connect import web connect() web.serve()