Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
R. Nestler
firmware
Commits
8e8d8614
Commit
8e8d8614
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(apps): Add scope to preload
parent
e1a7684a
Branches
master
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
preload/apps/scope/__init__.py
+35
-0
35 additions, 0 deletions
preload/apps/scope/__init__.py
preload/apps/scope/metadata.json
+1
-0
1 addition, 0 deletions
preload/apps/scope/metadata.json
with
36 additions
and
0 deletions
preload/apps/scope/__init__.py
0 → 100644
+
35
−
0
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
This diff is collapsed.
Click to expand it.
preload/apps/scope/metadata.json
0 → 100644
+
1
−
0
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment