Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 37 ยท Getting Started

What Is Arduino?

Meet Arduino: an open-source family of microcontroller boards and a simple C++ toolchain. Learn what a microcontroller is, what a sketch does, and what you can build.

Arduino is an open-source platform for building things that sense and control the physical world. It has two parts: small circuit boards that carry a microcontroller (a tiny computer on a single chip), and free software that lets you write a program, called a sketch, and copy it onto the board. Once the sketch is on the board, the board runs it by itself, with no computer attached, as long as it has power.

People use Arduino to blink lights, read temperatures, drive motors, build robots, make musical instruments and automate plants, doors and 3D printers. It became popular because the first blinking LED takes ten minutes, and the same skills scale up to serious projects.

How this tutorial works. The Arduino IDE, the compiler and your board cannot run inside a web page, so Arduino code in this course is shown in read-only blocks. Wherever an idea can be explained with ordinary code, we give you a clearly labelled stand-in written in C that you can run here: a tiny simulated board, a simulated clock, bit-twiddling you can test. The stand-ins use the same logic as the real thing, but they are not the real hardware. We only print output for the real board when we are certain of it.

Microcontroller versus computer

The laptop you are using has a processor, gigabytes of memory, a disk and an operating system. A microcontroller puts a much smaller processor, a few kilobytes of memory, program storage and many input/output pins all on one chip. There is no operating system: your program is the only thing running.

Laptop Arduino Uno (ATmega328P)
Clock speed billions of cycles per second 16 million cycles per second
Working memory (RAM) gigabytes 2 KB
Program storage (flash) disk, terabytes 32 KB
Operating system yes none
Talks to the world through screen, keyboard, network pins you connect to LEDs, sensors, motors
Typical price hundreds of dollars a few dollars

Such small numbers sound limiting, but a blinking LED or a thermostat needs very little. The trade-off is that you must think about memory, timing and electricity in ways desktop programming rarely asks of you.

The Arduino idea: sense, decide, act

Almost every Arduino project follows the same loop:

  1. Sense. Read the world: a button press, a light level, a distance.
  2. Decide. Run your logic: if it is dark, turn the lamp on.
  3. Act. Change the world: switch a LED, spin a motor, print a message.

The microcontroller repeats this thousands of times per second. Your whole job as an Arduino programmer is to describe the three steps.

flowchart LR
    S["Sensors<br/>button, light, temperature"] --> M["Microcontroller<br/>your sketch"]
    M --> A["Actuators<br/>LED, motor, buzzer"]
    A -. "changes the world" .-> S

Figure: the sense-decide-act cycle. Actuators change the world, and the sensors notice the change.

What a sketch looks like

A sketch is a C++ program with two special functions. Here is the classic first sketch, shown read-only because it needs a real board:

C++
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);   // runs once at power-on
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH); // LED on
  delay(1000);                     // wait one second
  digitalWrite(LED_BUILTIN, LOW);  // LED off
  delay(1000);
}

setup() runs once when the board powers up or resets. loop() then runs again and again, forever. You never write main(): the Arduino core library supplies one that calls your two functions. Sketch Anatomy explains this in detail, and Your First Sketch: Blink walks through uploading it.

A stand-in you can run

The program below is not Arduino: it is plain C that imitates how an Arduino runtime calls setup() once and then loop() repeatedly. We stop after five turns because a real board never stops.

C Stand-in: how setup() and loop() are called

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

The real core's main() is almost exactly this, with an infinite loop and a little serial-port housekeeping added.

Pins: where code meets copper

A board has rows of metal sockets or pads called pins. Each pin connects to one leg of the microcontroller. In your code you pick a pin by number, tell the chip whether it should listen (input) or talk (output), and then read or write its voltage. The voltage is either high (about 5 V on an Uno, 3.3 V on many newer boards) or low (0 V). A pin set high can power a small LED; a pin read high tells you a button is pressed, or not, depending on the wiring.

The next stand-in models three pins as variables. Writing to an output pin changes a stored level, and reading it shows the level. It is a toy, but it makes the vocabulary concrete.

C Stand-in: a board with three pins

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Notice that the write to pin 2 had no effect because that pin was never made an output. Real hardware is subtler (writing to an input pin can switch an internal pull-up resistor, see Pull-Up Resistors and Debouncing), but the principle that a pin must be configured first is real.

What you can build

What can Arduino do?

Lights LEDs, strips, displays
Sensing Heat, light, distance
Motion Motors and servos
Sound Buzzers and music

One chip, many jobs.

1 / 2

The ecosystem

Arduino is more than the Uno. There are small boards (Nano), big boards (Mega with 54 pins), boards with Wi-Fi and Bluetooth (ESP32 and Nano 33 IoT), and hundreds of compatible clones. Thousands of libraries add support for displays, sensors, radios and motor drivers. Boards Compared helps you choose one.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a sketch's setup() function do?

    setup() runs a single time at power-on or reset; loop() is the part that repeats.
  2. 2. Which is true about an Arduino Uno compared with a laptop?

    The ATmega328P has 2 KB of RAM and runs only your sketch. Once programmed, it can run from any suitable power source.
  3. 3. Which sequence describes the usual structure of an Arduino project?

    Sensors give inputs, your code decides, and actuators change the world.
  4. 4. Why does this course use C stand-ins for some examples?

    We show real sketches read-only and use labelled C simulations for runnable practice.

Summary

  • Arduino is a family of microcontroller boards plus free tools for writing sketches.
  • A microcontroller is a tiny, single-chip computer with little memory and many I/O pins.
  • A sketch has setup() (once) and loop() (forever); the core supplies main().
  • Projects follow sense, decide, act.
  • In this course, real code is read-only and C stand-ins are labelled.

Next: Electronics Basics: Voltage, Current and Ohm's Law