# octopusLAB simple example # ESP32board with "BUILT_IN_LED" # parameter: delay [ms] from util.led import Led # from util.octopus import led # short way from util.pinout import set_pinout print("---examples/blink_param.py---") # _ARGS # ToDo parse: delay=1000,pin=25 delay = 1000 try: delay = (int(_ARGS[0])) print("delay = ", str(delay)) except Exception as e: print("Exception: {0}".format(e)) pinout = set_pinout() # set board pinout led = Led(pinout.BUILT_IN_LED) # BUILT_IN_LED = 2 # start main loop while True: led.blink(delay)
header["Content-Type"] = "application/x-www-form-urlencoded" deviceID = Env.uID place = "octoPy32" value = int(float(Env.ver) * 100) try: postdata_v = "device={0}&place={1}&value={2}&type={3}".format( deviceID, place, value, "val") res = post(urlPOST, data=postdata_v, headers=header) sleep_ms(100) print("sendValue.ok") except: print("E.sendValue") print('Im ready') led.blink() if isDisp7: try: from util.octopus import disp7_init disp7 = disp7_init() disp7.show(get_hhmm("-")) sleep(3) disp7.show(" ") except Exception as e: print("Exception: {0}".format(e)) if isOled: try: from util.octopus import oled_init oled = oled_init(runTest=False)
# octopusLAB test - 2019 from time import sleep from util.octopus import button_init, button, w, web_server, ap_init from util.led import Led led = Led(2) button0 = button_init(0) debounce = 9 ap = False print("esp32 web server - start >") for id in range(10): print(10 - id) led.blink() if button(button0)[0] >= debounce: print("button > AP_start") ap = True for id in range(5): led.blink(100, 100) break sleep(1) if ap: wc = ap = ap_init() else: wc = w() sleep(1) web_server()