How michael-graves/ball-and-plate works
Ball-and-Plate is embedded firmware for balancing a ball on a two-axis plate. The main loop schedules touch sampling, PID updates and motor commands; button input selects operating modes, including circular setpoint motion, while UART provides serial output. The documented sensing, feedback-control and servo-actuation stages are represented alongside button and communication capabilities. Source excerpts show the main controller calling peripheral modules; calibration is present but explicitly marked unused. Edges are limited to relationships shown by excerpts or README; unsampled main-loop details are not inferred.
Main entry points: main.c Runtime Controller · button.c Button Debounce · touch.c Touchscreen ADC · servo.c Servo PWM
Components 11
Control Loop
- Runtime Controller
main.c - PID Feedback
main.c - Mode Setpoints
main.c - SysTick Scheduler
main.c
Board I/O
- Touchscreen ADC
touch.c - Button Debounce
button.c - Servo PWM
servo.c - Serial Communication
com.c
Position Support
- Touch Calibration
touchCalibration.c
Other components
- Operator
- Ball Position
Connections 13
- Runtime Controller → Touchscreen ADC: samples position
main.c - Runtime Controller → PID Feedback: updates control
main.c - Runtime Controller → Servo PWM: sets angles
main.c - Runtime Controller → Button Debounce: initializes callback
main.c - Runtime Controller → Serial Communication: initializes and sends
main.c - Runtime Controller → SysTick Scheduler: initializes timer
main.c - Button Debounce → Runtime Controller: calls mode callback
button.c - SysTick Scheduler → Runtime Controller: sets update flags
main.c - Operator → Button Debounce: presses controls
README.md - Ball Position → Touchscreen ADC: provides position input
README.md - Touch Calibration → Touchscreen ADC: could calibrate
- Servo PWM → Ball Position: tilts platform
README.md - Serial Communication → Operator: serial output