# simple oled oscilloscope # freqency test # signal pwmPin 16 > RC > analog read anIn 35 import machine from util.octopus import * from util.analog import Analog import array as arr octopus() signalFreq = 1000 pixel2sample = 1 div = 100 # 4085 max > ymax samples = 512 print("oled: ") XMAX = 128 YMAX = 64 o = oled_init(XMAX, YMAX) # init oled display sleep(1) o.clear() # clear pwmPin = machine.Pin(16) signal = PWM(pwmPin) # servo2 signal.freq(signalFreq) # Hz 100-1000 signal.duty(512) # signal.deinit() anIn = Analog(35)
# octopusLAB simple example # ESP32board + wifi -> analog 36, 39, ... from util.analog import Analog from util.octopus import * octopus() # include main library anIn = Analog(36) #analog input def sendValue(value = 0,urlPOST = "http://www.octopusengine.org/iot17/add18.php"): from urequests import post header = {} 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,"batRaw") res = post(urlPOST, data=postdata_v, headers=header) sleep_ms(100) print("sendValue.ok") except: print("E.sendValue") print('Start >') led.value(1) w() led.value(0) sleep(3)
def octopus(): from util.octopus import * octopus()