Skip to content
Snippets Groups Projects
Commit 8e8d8614 authored by schneider's avatar schneider
Browse files

feat(apps): Add scope to preload

parent e1a7684a
Branches master
No related tags found
No related merge requests found
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)
\ No newline at end of file
{"name":"Scope","description":"A very simple egg that reads the light sensor and displays its raw value and a scope. Will be extended to other ADC channels once we have the firmware ready.","category":"hardware","author":"koalo","revision":1}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment