Getting Started with Arduino

Getting Started with Arduino

Set up your board, install the IDE, and upload your first sketch.

What is Arduino?

Arduino is an open-source electronics platform combining a microcontroller board with a simple programming environment. You write sketches (programs) in C/C++, upload them over USB, and the board runs them independently ߀” no computer needed after upload.

The most common beginner board is the Arduino Uno, which has:

  • An ATmega328P microcontroller running at 16 MHz
  • 14 digital I/O pins (6 with PWM)
  • 6 analog input pins
  • 32 KB of flash memory for your program
  • USB connection for programming and power

Installing the Arduino IDE

  1. Download the Arduino IDE 2 from arduino.cc/en/software
  2. Run the installer and accept defaults
  3. Open the IDE ߀” you will see the editor, a toolbar, and a console at the bottom

Connecting Your Board

  1. Plug your Arduino into your computer with a USB cable
  2. In the IDE, go to Tools ߆’ Board and select your board (e.g., Arduino Uno)
  3. Go to Tools ߆’ Port and select the COM port that appeared (e.g., COM3 on Windows, /dev/ttyUSB0 on Linux)

If no port appears, install the USB driver for your board (CP210x or CH340, depending on the clone).

Every Arduino beginner starts with Blink ߀” making the built-in LED flash on and off.

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);  // Set the built-in LED pin as output
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // Turn LED on
  delay(1000);                      // Wait 1 second
  digitalWrite(LED_BUILTIN, LOW);   // Turn LED off
  delay(1000);                      // Wait 1 second
}

Uploading a Sketch

  1. Click the checkmark (ß?“) button to compile ߀” errors appear in the console
  2. Click the arrow (߆’) button to upload ߀” the IDE compiles and transfers the code
  3. Watch the board's RX/TX LEDs flicker during upload
  4. The built-in LED (pin 13) should start blinking once per second

Sketch Structure

Every Arduino sketch has exactly two required functions:

Function Runs Purpose
setup() Once at power-on Initialise pins, serial, libraries
loop() Continuously forever Your main program logic

There is no main() ߀” the Arduino framework calls these functions for you.

Pin Numbering

Label Meaning
0߀“13 Digital pins (Uno)
A0߀“A5 Analog input pins (also usable as digital)
LED_BUILTIN Built-in LED, usually pin 13
~ (tilde prefix) Supports PWM output

Common Mistakes for Beginners

  • Wrong board or port selected ߀” always check Tools menu before uploading
  • Missing semicolons ߀” C++ requires ; at the end of every statement
  • Using pin 0 or 1 ߀” these are shared with USB serial; avoid them while debugging
  • No delay() ߀” without pauses, your loop runs millions of times per second