Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ln
firmware
Commits
8e8d8614
Commit
8e8d8614
authored
Aug 21, 2019
by
schneider
Browse files
feat(apps): Add scope to preload
parent
e1a7684a
Changes
2
Hide whitespace changes
Inline
Side-by-side
preload/apps/scope/__init__.py
0 → 100644
View file @
8e8d8614
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
preload/apps/scope/metadata.json
0 → 100644
View file @
8e8d8614
{
"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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment