Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Stopwatch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ef1g21
Stopwatch
Commits
120fcfb7
Commit
120fcfb7
authored
2 years ago
by
ef1g21
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
ac36e25b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stopwatchSkeleton.py
+27
-0
27 additions, 0 deletions
stopwatchSkeleton.py
with
27 additions
and
0 deletions
stopwatchSkeleton.py
0 → 100644
+
27
−
0
View file @
120fcfb7
import
machine
import
utime
#TODO: Initialise start/stop buttons and the buzzer for signalling the end of the stopwatch
while
True
:
while
start
.
value
()
==
1
:
utime
.
sleep_ms
(
10
)
#TODO: Get the current time when start button is pressed
print
(
"
Start timer
"
)
while
stop
.
value
()
==
1
:
utime
.
sleep_ms
(
10
)
#TODO: Get the current time when stop button is pressed
buzzer_pin
.
value
(
1
)
utime
.
sleep
(
0.5
)
buzzer_pin
.
value
(
0
)
print
(
"
Timer stopped
"
)
#TODO: Find the elapsed time in ms
timeInSecs
=
time
/
1000
print
(
"
Stopwatch time:
"
,
timeInSecs
,
"
s
"
)
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