Stopwatch MicroSim
Copy this iframe to your website:
1 | |
Run the Stopwatch MicroSim in fullscreen
Description
This MicroSim simulates a digital stopwatch with start/stop and reset functionality. It displays elapsed time in minutes, seconds, and milliseconds format (MM:SS.mmm), similar to what you would see on a real OLED display.
Key features:
- OLED-style black display with white text
- Start/Stop toggle button
- Reset button to clear elapsed time
- High-precision millisecond timing
- Debounce protection on button presses
How to Use
- Click "Start/Stop" to begin timing
- Click "Start/Stop" again to pause
- Click "Reset" to clear the elapsed time
- The timer continues from where it left off when resumed
Related Lab
The Stopwatch MicroSim allows you to simulate the actual stopwatch hardware lab: Stopwatch Lab
Lesson Plan
Learning Objectives
After completing this lesson, students will be able to:
- Understand state management in user interfaces (running vs. stopped)
- Calculate elapsed time using system timestamps
- Format time values into human-readable strings
Target Audience
- Grade level: Middle school to high school (grades 6-12)
- Prerequisites: Basic understanding of time measurement
Activities
- Exploration Activity: Use the stopwatch to time various activities and record results
- Guided Investigation: Compare the accuracy of this digital stopwatch to a physical one
- Extension Activity: Modify the code to add lap time functionality
Assessment
- Can students explain how elapsed time is calculated?
- Can students describe the difference between running and stopped states?
- Can students suggest improvements to the stopwatch functionality?
References
- p5.js Reference - Documentation for the p5.js library
- JavaScript Date Object - MDN documentation on JavaScript timing
- State Machine Design - Wikipedia article on finite state machines