BASICS AND INTRO PART
ARDUINO UNO DEVELOPMENT BOARD
At mega 3,2 chip is in Arduino
Smd devices is used in phone and in this chip
Operational voltage is 5
S M D-surface mountD LAP CONNECTION
Different types of Arduino is exist in the setting of smd
Embeded C is used as communicative language
Digital and analog conditions occared in the board
Digital-0,1
Analog-0,points and 1
In top zeero to 13-digital pins
In bottom A0 to A5 analog pins
GND external supply
Sensors are output devices
NEXT IS BOARD AND LAP CONNECTION
Introducing ARDUINO SOFTWARE
Select port and board to connect board with lap
Port COM4 IS used here
Board is ARDUINO UNO
DIDITAL OPERATIONS
Session 1
1. BLINK LED
HIGH-ON means 1
Low -off means 0
Delay is 10000, means one second
WRITE CODE and verify then upload
Connection:
Connect 6 th pin of board to positive of light and gnd to -ve
2. Motion detector/gas detector
Vcc to 5v in board
Gnd to gnd
A0 to A1 in board
Can see data change on serial monitor
3. SENSOR
GND TO GND
VCC to 5v
Out to 4 of board
4. Sensor with LED
VCC to 5v
Led posv to 2 of board
Led -ve to gnd of board
Others are same
5. USING IF ELSE SAME
A0 TO A1
Gnd to gnd
Vcc to 5
Pos of LED to 4
Neg of LED TO DIFITAL PIN GND
6. Relay/switch
Vcc to 5v
Gnd to gnd
In to 3.3V ON board
ANALOG WRITE
PWD-Pulse with modulation
7.LED
void setup() {
// put your setup code here, to run once:
pinMode(6,OUTPUT);
pinMode(2,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(6,HIGH);
delay(100);
digitalWrite(6,LOW);
digitalWrite(2,HIGH);
delay(100);
digitalWrite(2,LOW);
digitalWrite(6,HIGH);
delay(100);
void setup() {
// put your setup code here, to run once:
pinMode(6,OUTPUT);
pinMode(2,OUTPUT);
pinMode(5,OUTPUT);
LED 2
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(6,HIGH);
delay(1000);
digitalWrite(6,LOW);
digitalWrite(2,HIGH);
delay(1000);
digitalWrite(2,LOW);
digitalWrite(5,HIGH);
delay(1000);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
DIGITAL
void setup() {
// put your setup code here, to run once:
pinMode(4,INPUT);
pinMode(2,OUTPUT);
Serial.begin(9600);
void loop() {
int IR=digitalRead(4);
Serial.print("SENSOR VALUE=");
Serial.println(IR);
if(IR==0){
digitalWrite(2,HIGH);
else
digitalWrite(2,LOW);
// put your main code here, to run repeatedly:
}
ANALOG SENSOR
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
void loop() {
// put your main code here, to run repeatedly:
int sensor=analogRead(A1);
Serial.print("SENSOR VALUE=");
Serial.println(sensor);
ANALOG AND DIGITAL
void setup() {
// put your setup code here, to run once:
pinMode(9,OUTPUT);
void loop() {
for(int i=0; i<255; i++){
analogWrite(9, i);
delay(5);
// put your main code here, to run repeatedly:
for(int i=255; i>0; i--){
analogWrite(9, i);
delay(5);
ULTRASONIC
const int trigPin=8;
const int echoPin=9;
long duration;
int distance;
void setup() {
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(10,OUTPUT);
Serial.begin(9600);
//put your setup code here, to run once:
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance=duration*0.034/2;
Serial.print("disctance:");
Serial.println(distance);
if(distance<=10){
digitalWrite(10,HIGH);
delay(1000);
else{
digitalWrite(10,LOW);
delay(1000);
// put your main cod;e here, to run repeatedly:
SENSOR
void setup() {
// put your setup code here, to run once:
pinMode(9,OUTPUT);
void loop() {
for(int i=0; i<255; i++){
analogWrite(9, i);
delay(5);
// put your main code here, to run repeatedly:
for(int i=255; i>0; i--){
analogWrite(9, i);
delay(5);
}
BULB
void setup() {
// put your setup code here, to run once:
pinMode(6,OUTPUT);
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(6,HIGH);
delay(1000);
digitalWrite(6,LOW);
delay(1000);
TRAFFIC
void setup() {
// put your setup code here, to run once:
pinMode(6,OUTPUT);
pinMode(2,OUTPUT);
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(6,HIGH);
delay(100);
digitalWrite(6,LOW);
digitalWrite(2,HIGH);
delay(100);
digitalWrite(2,LOW);
digitalWrite(6,HIGH);
delay(100);