Arduino Basics

Getting Started with Arduino

Arduino is the most popular platform for beginners in robotics. Let's learn the basics!

Arduino Board Anatomy

  • Digital Pins (0-13): Read/write HIGH or LOW signals
  • Analog Pins (A0-A5): Read sensor values (0-1023)
  • Power Pins: 5V, 3.3V, GND
  • USB Port: Programming and power

Arduino Program Structure

// Arduino code has two main functions

void setup() {
  // Runs ONCE when Arduino starts
  pinMode(13, OUTPUT);  // Set pin 13 as output
  Serial.begin(9600);   // Start serial communication
}

void loop() {
  // Runs REPEATEDLY forever
  digitalWrite(13, HIGH);  // Turn LED ON
  delay(1000);             // Wait 1 second
  digitalWrite(13, LOW);   // Turn LED OFF
  delay(1000);             // Wait 1 second
}

First Project: Blinking LED

Components needed:

  • Arduino Uno board
  • LED
  • 220Ω resistor
  • Breadboard and jumper wires

Circuit:

  1. Connect LED long leg (anode) to Arduino pin 13
  2. Connect 220Ω resistor to LED short leg (cathode)
  3. Connect resistor other end to GND

Installing Arduino IDE

  1. Download from arduino.cc
  2. Install the software
  3. Connect Arduino via USB
  4. Select Board: Tools → Board → Arduino Uno
  5. Select Port: Tools → Port → (your Arduino port)
  6. Click Upload button

✅ Success! If your LED blinks, congratulations! You've programmed your first Arduino project.