Lets start learning Arduino. start a new journey!
Start TutorialArduino is an open-source electronics platform that allows anyone, from beginners to advanced users, to create interactive projects. In this tutorial series, we will guide you through setting up your Arduino, understanding its coding environment, and writing your first program.
Arduino is a microcontroller board that enables users to build electronic projects easily. It is widely used for robotics, automation, and IoT applications.
Arduino Uno (Most commonly used)
Arduino Mega (More I/O pins for complex projects)
Arduino Nano (Compact and useful for small projects)
Arduino Leonardo (Has built-in USB communication)
Download the Arduino IDE from Arduino's official website.
Install the software and open it.
Connect your Arduino board to your PC via USB.
Select the correct board (Tools > Board > Arduino Uno).
Select the correct COM port (Tools > Port > COMx).
The Arduino IDE consists of the following:
Code Editor - Where you write the program (sketch).
Verify Button - Checks for errors in your code.
Upload Button - Uploads code to the Arduino board.
Serial Monitor - Displays messages from the board.
This program makes an LED blink every second.
void setup() {
pinMode(13, OUTPUT); // Set Pin 13 as output
}
void loop() {
digitalWrite(13, HIGH); // Turn LED on
delay(1000); // Wait for a second
digitalWrite(13, LOW); // Turn LED off
delay(1000); // Wait for a second
}
Every Arduino program has two main functions:
setup()
: Runs once when the Arduino starts.
loop()
: Repeats continuously after setup()
.
Analog and Digital pins programming
Digital pins can be HIGH (1) or LOW (0), while analog pins read sensor values (0 to 1023).
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(500);
}
The Serial Monitor is used to send and receive data from the Arduino.
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("Hello, Arduino!");
delay(1000);
}
int sensorPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
float temperature = analogRead(sensorPin) * (5.0 / 1023.0) * 100;
Serial.println(temperature);
delay(1000);
}
#include <Servo.h>
Servo myServo;
void setup() {
myServo.attach(9);
}
void loop() {
myServo.write(90); // Move to 90 degrees
delay(1000);
myServo.write(0); // Move to 0 degrees
delay(1000);
}
Missing semicolon (;)
Incorrect COM Port selection
Board Not Recognized (install drivers if needed)