This repository contains a collection of beginner-friendly Arduino example programs designed to teach fundamental embedded programming concepts used in robotics β including LED control, button inputs, and sequential logic.
These examples serve as the foundation for SumoBot development, where control logic, sensors, and motor drivers can be layered on top of the same patterns shown here.
| File | Description |
|---|---|
ex1.h |
Basic Arduino template showing setup() and loop() structure |
ex2.h |
Blink on-board LED at 1 Hz (every 0.5 s) |
ex3.h |
Blink LED using variables for timing (adjustable interval) |
ex4.h |
Control an LED using a button input (digitalRead) |
ex5.h |
Sequentially light up multiple LEDs in order |
ex6.h |
Use a for loop and if statement to automate LED sequence |
ex7.h |
Alternate LED sequence direction when button is pressed |
Workshop-IntroToProgramming.ino |
Main Arduino sketch integrating these examples for workshops or robotics demos |
- Arduino Uno or compatible board
- 4Γ LEDs
- 4Γ 220 Ξ© resistors
- 1Γ push-button
- 1Γ 10 kΞ© pull-down resistor (optional if using internal pull-ups)
- Jumper wires and breadboard
Pin Mapping:
| Component | Pin |
|---|---|
| Button | D8 |
| LED 1 | D9 |
| LED 2 | D10 |
| LED 3 | D11 |
| LED 4 | D12 |
| On-board LED | D13 |
These examples demonstrate:
- Digital I/O: Reading inputs and writing outputs
- Control flow: Using
if,else, and loops - Timing: Using
delay()for sequencing actions - Variable logic: Adjusting LED behavior dynamically
- Robotics fundamentals: Translating LED logic into motor or sensor control logic for SumoBots
- Open
Workshop-IntroToProgramming.inoin Arduino IDE. - Connect your Arduino board and select the correct Port and Board type.
- Upload any example code (
ex#.h) into the sketch or use#includestatements to test specific lessons. - Observe LED patterns and button responses on your breadboard.
- Modify intervals, LED order, or button logic to experiment β thatβs how SumoBot logic starts!
Once comfortable with these basics:
- Replace LEDs with motor driver control pins.
- Use button logic to toggle forward / reverse / stop states.
- Add sensors (ultrasonic, IR, line tracking) to replace manual button control.
- Tune response intervals for real-time match behavior.
Hereβs how you might evolve ex7.h into a simple SumoBot forward/backward controller:
if (digitalRead(button)) {
// Reverse direction
motorLeft.backward();
motorRight.backward();
} else {
// Forward direction
motorLeft.forward();
motorRight.forward();
}MIT License β free for educational and personal robotics use.
Made by Brody L. Co-Author by Bex S.