Skip to content

CSULB-EATS/Arduino_SMB_Example_Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Arduino SumoBot Example Programs

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.

πŸ“ Project Overview

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

βš™οΈ Hardware Requirements

  • 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

🧩 Learning Objectives

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

πŸš€ How to Use

  1. Open Workshop-IntroToProgramming.ino in Arduino IDE.
  2. Connect your Arduino board and select the correct Port and Board type.
  3. Upload any example code (ex#.h) into the sketch or use #include statements to test specific lessons.
  4. Observe LED patterns and button responses on your breadboard.
  5. Modify intervals, LED order, or button logic to experiment β€” that’s how SumoBot logic starts!

🧠 Next Steps (For Robotics Integration)

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.

🧰 Example Extension

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();
}

πŸ“œ License

MIT License β€” free for educational and personal robotics use.

Made by Brody L. Co-Author by Bex S.

About

Arduino SumoBot Example Programs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •