Getting Started With Arduino IDE (1)
Getting Started With Arduino IDE (1)
Arduino IDE
This presentation guides you through the basics of Arduino
programming. Learn about the IDE setup and core functions.
Discover digital and analog I/O and how to use sensors. We'll
end with a mini-project: Auto Light System!
SV
by SOORAJ VS
Installing Arduino IDE
First, download the Arduino IDE from the official Arduino website.
Download
Install
Drivers
Arduino Programming Basics
Arduino programs are structured around two essential functions:
loop(): This function runs continuously. The main program code goes here.
Setup()
Initialization
Loop()
Main Program
Digital vs Analog I/O
Digital I/O: Digital pins are either HIGH (5V) or LOW (0V). Use them for simple on/off control.
Analog I/O: Analog pins can read a range of voltage values (0-5V). Use them for sensors that provide variable readin
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
This code sets pin 13 as an output, then toggles it HIGH and LOW with a 1-second delay.
What is a Sensor?
A sensor is a device that detects a physical quantity. Then, it
converts it into an electrical signal.
Read sensor data using functions like digitalRead() for digital sensors and
analogRead() for analog sensors.
Connect
Read Data
Process
Common Sensor Code Example
Example code for reading an analog sensor (e.g., LDR on pin A0):
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(100);
}
This code reads the analog value and prints it to the serial monitor.
Mini Project – Auto Light System
Create an automatic light system using an LDR.
Use analogRead() to read the LDR value. Use digitalWrite() to control the LED.
Check Value
2
Read LDR
1
Turn On LED
3
Summary & Next Steps
You've learned the basics of Arduino IDE, programming, and
sensors. Practice with different sensors and projects.
Practice
Explore