from machine import Pin,I2C, ADC import ssd1306 import time import math i2c = I2C(scl=Pin(27), sda=Pin(26)) oled = ssd1306.SSD1306_I2C(128,64,i2c) adc = ADC(Pin(34,Pin.IN)) oled.fill(0) oled.show() global gainScale global timeScale def drawAxis(): oled.hline(0,32,128,1) oled.vline(64,0,64,1) oled.show() gainScale = 0.25 timeScale = 0.05 while True: T = [] drawAxis() for i in range(0,256): T.append(int(-1*adc.read()/30*gainScale)+63) time.sleep(timeScale) print(adc.read()) for i in range(0,2): for j in range(0,128): oled.pixel(j,T[i*128+j],1) drawAxis() oled.text("mV:"+str(550/gainScale), 0, 23, 1) oled.text("t:"+str(timeScale*128)+"s", 0, 34, 1) oled.show() oled.fill(0) drawAxis() oled.show()