Week 7 · Displays & Signals
Session 34: Formatted text and an LCD dashboard
Learning outcomes
- Build fixed-width text with snprintf and %02d
- Format floats with dtostrf, because %f does not work on the Uno
- Update an LCD dashboard without flicker or leftover characters
Kit and components
- Uno, I2C LCD, 10 kΩ potentiometer, push button, breadboard
Pre-reading about 25 min
Students read these on their phones before class. They are listed on the student Before class page.
Session plan
- 0:0010 minRecap
Quiz: IR or I2C
- 0:1020 minDemo
One buffer per row
Show snprintf into a 17-character buffer, %02d padding, and %f printing a question mark on the Uno.
- 0:3045 minCode Along
Text and time formatting
- 1:1535 minBuild
LCD dashboard
Row 1 shows the potentiometer as volts to two decimals with dtostrf; row 2 shows the uptime as HH:MM:SS and a button count, updated every 250 ms with millis().
- 1:5010 minWrap-up
Fixed width, no crumbs
Checkpoint: ready to move on?
Students' dashboard shows both rows at fixed widths with no leftover characters while the values change.
Extension for fast finishers
Catch-up path
Build row 2 of the dashboard only.
Homework and practice
Code Along 14.3 and 14.4.
Facilitator notes
- Task B needs a temperature shown to 0.1 °C on the LCD - this session is the practice.