GK SOLUTIONS
AI • IoT • Arduino • Projects & Tutorials
DEFEAT THE FEAR

Arduino Introduction

⏱️ Estimated time: 15 minutes | Difficulty: Beginner

Table of Contents

What is Arduino?

Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects. Arduino consists of both a physical programmable circuit board (often referred to as a microcontroller) and a piece of software, or IDE (Integrated Development Environment) that runs on your computer.

Note on Simplicity

Unlike most previous programmable circuit boards, the Arduino does not need an extra piece of hardware (called a programmer) in order to load new code onto the board — you can simply use a USB cable.

Why Learn Arduino?

Arduino makes interacting with the physical world through code easier than ever.

  • Inexpensive: Arduino boards are relatively inexpensive compared to other microcontroller platforms.
  • Cross-platform: The Arduino IDE runs on Windows, Macintosh OSX, and Linux.
  • Simple code environment: Uses a simplified version of C++, making it extremely accessible for beginners.
  • Open source hardware: You can build your own boards or alter the existing ones.

The "Hello World" of Hardware (Blink)

In the programming world, the first program is usually "Hello World". In the microcontroller world, making an LED blink is the equivalent.

// Simple Arduino code to blink the built-in LED
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off
  delay(1000);                      // wait for a second
}
Try It on Hardware
Simulation Output: \nLED State: HIGH (1s)\nLED State: LOW (1s)\n[Repeats infinitely...]

Explanation of the Arduino Program

Arduino code is fundamentally split into two main functions.

1

void setup() { ... }

The setup() function is called once when the sketch starts. Use it to initialize variables, pin modes, start using libraries, etc.

2

pinMode(LED_BUILTIN, OUTPUT);

Configures the specified pin to behave either as an input or an output. Here, we tell the board that the built-in LED pin will be outputting electricity.

3

void loop() { ... }

After setup() finishes, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond.

4

digitalWrite(pin, state); and delay();

digitalWrite sets the voltage to HIGH (5V) or LOW (0V). delay(1000) pauses the program for 1000 milliseconds (1 second).

Applications of Arduino

  • Robotics: Motor control, sensor reading, and autonomous navigation.
  • Home Automation: Controlling lights, reading temperature sensors, IoT applications.
  • Prototyping: Rapidly testing hardware ideas before pushing them to production PCB boards.
  • Interactive Art: Installations that respond to sound, light, or human presence.
← Overview Next Lesson: Breadboards & Components →