Toggle Navigation
Hatchery
Eggs
Scope
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import os import display import utime import buttons import light_sensor import math WIDTH=160 HEIGHT=80 disp = display.open() light_sensor.start() history = [] while True: disp.clear() value = light_sensor.get_reading() history.insert(0, value) if len(history) > WIDTH: history.pop() disp.print("%i"%value) for i in range(0,len(history)): # Rescale to range 0 <= value < HEIGHT-1 y = math.floor(history[i]*(HEIGHT-2)/max(history)) disp.pixel(WIDTH-i, HEIGHT-y-1) disp.update() utime.sleep(0.1)