import network import socket import time import dht import json import machine from machine import Timer, Pin import uasyncio as asyncio from time import sleep import uerrno from structure import machine_data, color, cam, wifi import gc import camera cam.start() wifi.connect('1255', '12551255') data_host = "asmon.com.ar" USER = "******" data_address = '' cam_address = '' json_command = {} h = { 'POST': """POST /$req HTTP/1.1 Host: 127.0.0.1:9515 X-AIO-Key: xxxxxxxxxxxxxxxxxxx Content-Type: $type Content-Length: """ }
break sleep(.1) def sp(): th(plus,('st',)) def sn(): th(snap,('st',)) def ud(): th(ur,('st',)) def sc(): host, port = ['asmon.com.ar','8080'] #server_list[0].split(':') address = socket.getaddrinfo(host, port)[0][-1] th(start_com,(address,)) cr = cam.start() if not cr: print("Camera not ready. Can't continue!") else: pic = cam.frame_gen() # setup networking wifi.start() sleep(1) wifi.set_credentials('1255,12551255') credentials_state, cred_ssid, cred_psw = wifi.get_credentials() while credentials_state == False: print('Getting credentials...') credentials_state, cred_ssid, cred_psw = wifi.get_credentials() sleep(1)