Arduino 101 

Getting Started with Your First Arduino Project

Now that you have a basic understanding of Arduino hardware and software, let’s dive into some hands-on projects. Here's a simple example to get you started:

Project 1a: On-board LED Blink

Objective: Blink an LED connected to the Arduino board. This project requires only an Arduino board and a USB-B cable. We will use Arduino UNO and the on-board LED lamp connected to pin 13 of the UNO.

Components Needed:

Steps:


void setup() {

  pinMode(13, OUTPUT); // initialize digital pin 13 as an output.

}

void loop() {

  digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

  delay(1000);            // wait for a second

  digitalWrite(13, LOW);  // turn the LED off by making the voltage LOW

  delay(1000);            // wait for a second

}


OR

​Start the Arduino IDE

Open the “LED blink” example sketch: File -> Examples -> 01.Basics -> Blink      


2. Upload the Code:


3. Observe:


If it does, congratulations! You have successfully configured your Arduino hardware and software. 


Project 1b. External LED Blink

This project requires an Arduino board, LED diode, 200 ohm or equivalent resistor, breadboard (optional), and a USB-B cable.

In this project, you'll learn how to make an LED blink using an Arduino board. This is a fundamental project that introduces you to the basics of Arduino programming and circuit building.

Components Needed

Steps to Complete the Project

Step 1: Circuit Setup

Step 2: Write the Code

void setup() {

  // Initialize digital pin 13 as an output.

  pinMode(13, OUTPUT);

}


void loop() {

  // Turn the LED on (HIGH is the voltage level).

  digitalWrite(13, HIGH);

  // Wait for a second.

  delay(1000);

  // Turn the LED off by making the voltage LOW.

  digitalWrite(13, LOW);

  // Wait for a second.

  delay(1000);

}

Step 3: Upload the Code

Step 4: Observe the Blinking LED

If the LED starts to blink, You have successfully done 1b​ 

Note: if you don’t have a resistor, you can connect the LED directly to the UNO pins but the LED will be more bright. If you do so, please be nice to your eyes!

Project 2. Controlling LED Brightness With a Potentiometer

In this tutorial, we'll learn how to control the brightness of an LED using a potentiometer with Arduino. A potentiometer is a variable resistor that can be adjusted to provide different voltage levels. By connecting it to an analog input of the Arduino, we can adjust the brightness of an LED.

What You Will Learn:

Components Needed:

Circuit Diagram

The circuit diagram for this project can be constructed using the online Circuit CAD, a free tool by  Autodesk. This online platform, known as Tinkercad Circuits, allows users to create, simulate, and test electronics circuits directly in their web browsers without needing to download any software.

Tinkercad Circuits is ideal for beginners and Arduino enthusiasts, as it provides an intuitive interface and includes a library of electronic components, including Arduino boards, LEDs, resistors, and potentiometers.

You can access the online Circuit CAD through Autodesk's Tinkercad website to build and simulate your own circuits: [Tinkercad Circuits](https://www.tinkercad.com/circuits).

Step-by-Step Instructions:

Step 1: Connect the Potentiometer

The potentiometer has three pins:

Step 2: Connect the LED

Step 3: Upload the Code


Tinkercad Circuits

/* Control LED Brightness With a Potentiometer

  By. Fekadu Debebe

  Sept 20/2020

*/

// Constants

const int potPin = A0;    // Potentiometer pin

const int ledPin = 9;     // PWM pin connected to the LED


void setup() {

  // Initialize the LED pin as an output

  pinMode(ledPin, OUTPUT);

}


void loop() {

  // Read the potentiometer value (0 to 1023)

  int potValue = analogRead(potPin);

   // Map the pot value to the PWM range (0 to 255)

  int brightness = map(potValue, 0, 1023, 0, 255);

   // Set the brightness of the LED

  analogWrite(ledPin, brightness);

// Small delay for better stability

  delay(10);

}

Step 4: How It Works



If you have enjoyed the Arduino beginner tutorial, then check out the intermediate projects under "Arduino 102" section of this website.

»»» END of  Arduino 101 »»»