Skip to content

Repository files navigation

Arduino Programs Guide

Sketch compilation DOI License: MIT

Arduino Programs Guide 1.0.3 is a progressive, safety-first Arduino Uno course covering serial commands, LED patterns, PWM motor control, state machines, and emergency-stop behaviour. Each lesson includes a compile-checked sketch, wiring contract, test procedure, and extension ideas.

Caution

Never connect a DC motor directly to an Arduino pin. Motor lessons require a suitable transistor or H-bridge driver, flyback protection, an external motor supply, and a shared ground. Read Hardware safety before Exercises C–F.

Learning outcomes

  • Map serial commands to digital outputs and reusable functions.
  • Build non-blocking LED patterns with arrays, bit masks, and millis().
  • Drive motors safely with PWM, drivers, and fail-safe stops.
  • Integrate analog sensing, emergency override, and telemetry in Exercise F.

Learning path

Lesson Project Main concepts Hardware
A Arrow controller serial input, functions, digital output 4 LEDs
B Pattern selector arrays, bit masks, non-blocking timing 4 LEDs
C Smart fan PWM, command mapping, safe motor stop 3 LEDs, driver, motor
D Wheel simulation H-bridge direction, state machines 4 LEDs, dual driver, 2 motors
E Synchronized scanner numeric parsing, map(), animation 4 LEDs, driver, motor
F Integrated vehicle analog input, emergency override, telemetry full circuit

There is also a Bluetooth LED warm-up for testing a serial module before starting the main exercises.

Start here

  1. Read Getting started and Hardware safety.
  2. Build Exercise A with the board disconnected from power.
  3. Upload the sketch and test it in Serial Monitor before adding Bluetooth.
  4. Complete the lesson's verification checklist.
  5. After Exercise B, optionally try the companion ArduinoPatterns library.

All sketches use 9600 baud and accept the same characters from USB Serial or a TTL serial Bluetooth module. On an Uno, the hardware serial pins are shared with USB; disconnect the module from pins 0/1 while uploading.

arduino-cli compile --fqbn arduino:avr:uno exercises/exercise-a-arrow-controller

Instructor guidance

Item Guidance
Prerequisites Arduino Uno or compatible board, breadboard, LEDs/resistors, and for C–F a motor driver, flyback protection, and separate motor supply
Suggested pacing one lesson per session for A–B; one to two sessions for each motor lesson
Assessment require completed wiring checklists, Serial Monitor verification, and a short reflection on safety or non-blocking behaviour
Safety gate do not begin Exercises C–F until students can explain why motors need drivers and shared ground

Companion library progression

Exercise B teaches non-blocking patterns by hand. After students understand the timing model, they can optionally refactor LED banks and timed sequences with ArduinoPatterns. The course itself remains complete without the library.

Applications

  • Introductory Arduino Uno coursework and maker-space labs.
  • Safety-first PWM and H-bridge motor lessons.
  • Compile-checked embedded systems laboratories.
  • Independent practice with serial, state machines, and digital outputs.

Compatibility and limitations

The examples target the Arduino Uno and the Arduino AVR Boards core. CI compiles every sketch with the official Arduino toolchain; that is not hardware validation. Other boards may use different PWM pins, voltage levels, serial ports, or ADC ranges. Porting notes are welcome only when verified on hardware.

Documentation index

Citation

@dev.mako (devkyato). (2026). Arduino Programs Guide: safety-first compile-checked Arduino Uno course (Version 1.0.3). Zenodo. https://doi.org/10.5281/zenodo.21853286

See CITATION.cff for machine-readable metadata.

Connected projects

Project Role
ArduinoPatterns Optional non-blocking LED and digital-output library
Relay Timing-risk source review for control programs
OpenNet Typed ONP/1 messaging for ESP32, Raspberry Pi, and backends
Datary Local-first laboratory for reproducible program evidence

Contributing

Student contributions are encouraged. Good changes include clearer diagrams, hardware results, non-blocking improvements, and new tests that preserve each lesson's learning objective. Read CONTRIBUTING.md before opening a pull request.

License

MIT

About

A safety-first, compile-checked Arduino Uno course from serial-controlled LEDs to an integrated motor project.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages