References: Buttons, Interrupts, and State Machines
-
Finite-state machine - Wikipedia - Defines states, transitions, and inputs, with state diagrams and examples. It gives the formal vocabulary behind the chapter's clock mode state machine and run, set hour, and set minute cycling.
-
Interrupt - Wikipedia - Explains how a hardware signal pauses normal code so a handler can respond at once. It provides the background for this chapter's interrupt handlers, callbacks, and falling-edge triggers on button pins.
-
Rotary encoder - Wikipedia - Describes incremental encoders and their two-channel quadrature signals, which reveal rotation direction. It supports the chapter's encoder direction logic and the knob used to set the time.
-
Practical UML Statecharts in C/C++ (2nd Edition) - Miro Samek - Newnes (Elsevier) - Samek teaches state machines as event-driven code, building from basic automata to hierarchical statecharts with a small framework. It shows how a mode-cycling clock can be organized cleanly.
-
The Art of Designing Embedded Systems (2nd Edition) - Jack Ganssle - Newnes (Elsevier) - Ganssle, known for documenting real switch bounce on an oscilloscope, covers debouncing and its firmware implications. This book is chosen as the clearest practical treatment of why buttons chatter.
-
A Guide to Debouncing - The Ganssle Group - Presents oscilloscope captures showing how real switches bounce for varying times, plus the reasoning behind fixing it. It is a vivid companion to the chapter's bounce oscilloscope diagram and software debounce.
-
Writing interrupt handlers - MicroPython Documentation - Official guidance on keeping handlers short, avoiding memory allocation, and sharing data safely with the main loop. It applies directly to the chapter's button callbacks and flag-based design.
-
Getting Started with Rotary Encoders: Examples with Raspberry Pi Pico - Core Electronics - Walks through wiring an encoder to Pico pins and reading its turns in MicroPython, including how swapping the A and B pins reverses direction.
-
Button and Switch Basics - SparkFun Learn - Covers switch types, poles and throws, and pull-up resistors that keep an input at a known level. It reinforces the chapter's push button wiring between a GPIO pin and ground.
-
Sequential Logic: SR Flip-flop - Electronics Tutorials - Includes a hardware switch debouncing circuit built from an SR latch. It shows one way to clean a bouncing contact before the signal reaches the microcontroller, as in the chapter's hardware debounce section.