Objective: To Control (ON/ OFF) the devices using mechanical switching operation Components Required Arduino Uno Push Button Buzzer Connection Diagram Program int SwitchPin = 2, ButtonPin= 3, BuzzPin=13, sensorValue ; void setup() { pinMode(ButtonPin, INPUT); pinMode(BuzzPin, OUTPUT); Serial.begin(9600); } void loop() { sensorValue = digitalRead(ButtonPin); if(sensorValue == HIGH) { Serial.println(“LED ON”); digitalWrite(BuzzPin, HIGH); } […]
Category Archives: Arduino Programs
Objective: To measure the amount of temperature and moisture content present in the atmosphere Components Required Arduino Uno Temperature & Moisture Sensor (DHT-11) Connection Diagram Program #include <DHT.h> #define DHTtype DHT11 DHT dht(DHTpin, DHTtype); uint8_t temperature, humid, DHTpin=5; void setup() { Serial.begin(9600); pinMode(DHTpin,INPUT); dht.begin(); lcd.begin(); } void loop() { temperature = dht.readTemperature(); humid= dht.readHumidity(); […]
Objective: To control the rotation direction and to stop/start the DC motor by Arduino Uno Components Required Arduino Uno Direct Current (DC) Motor Connection Diagram Program int MotorPin1=4, MotorPin2=5; void setup() { pinMode(MotorPin1, OUTPUT); pinMode(MotorPin2, OUTPUT); } void loop() { digitalWrite(MotorPin1,HIGH); digitalWrite(MotorPin3,LOW); delay(5000); digitalWrite(MotorPin1,LOW); digitalWrite(MotorPin3,HIGH); delay(5000); } Working The DC motor has two […]
Objective: To measure the amount of temperature present in the atmosphere Components Required Arduino Uno Temperature Sensor (LM35) Connection Diagram Program int sensorPin = A0; int sensorValue = 0; void setup() { pinMode(sensorPin, INPUT); Serial.begin(9600); } void loop() { sensorValue = analogRead(sensorPin); float temperatureC=sensorPin/2.048; float temperatureF= ((temperatureC ) * 9.0 / 5.0) + 32.0; […]
Objective: To display the values corresponds to each key of a Remote Controller unit Components Required Arduino Uno IR Receiver Module Connection Diagram Program #include<IRremote.h> int RecvPin = 10; IRrecv irrecv(RecvPin); decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX); irrecv.resume(); delay(1000); } } Working Whenever […]
Objective: To measure the distance of the object present Components Required Arduino Uno Ultrasound Sensor Connection Diagram Program int trigPin = 2, echoPin = 3; long duration; int distance; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); Serial.begin(9600); } void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance= […]
Objective: To display the messages through LCD display Components Required Arduino Uno Liquid Crystal Display (LCD) Connection Diagram Program #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); void setup() { lcd.begin(); lcd.print(“Hello World”); } void loop() { } Working The LCD displays the characters based on allowing / blocking the light intensities by changing the […]
Objective: To Control (ON/ OFF) the devices connected in the AC supplies (230 V) Components Required Arduino Uno Relay Module Connection Diagram Program int RelayPin=13; void setup() { pinMode(RelayPin, OUTPUT); } void loop() { digitalWrite(RelayPin, HIGH); delay(1000); digitalWrite(RelayPin, LOW); delay(1000); } Working The Relay operates as Electrical Controlled switch. It has input […]
Objective: To detect the Light Intensity using LDR Sensor Components Required Arduino Uno Light Dependent Resistor (LDR) Sensor Resistance (1K Ohm) Connection Diagram Program void setup() { Serial.begin(9600); } void loop() { int sensorValue = analogRead(A0); Serial.print(“Light Intensity is :”); Serial.print(sensorValue); } Working The output of the LDR sensor is accessed by the […]
Objective: To detect the objects using IR sensor. Components Required Arduino Uno Infra Red Sensor Connection Diagram Program int sensorPin = 3; int sensorValue = 0; void setup() { pinMode(sensorPin, INPUT); Serial.begin(9600); } void loop() { sensorValue = digitalRead(sensorPin); if(sensorValue==HIGH) { Serial.println(“Object Detected”); } else { Serial.println(“Object not Detected”); } } Working The […]
- 1
- 2
Recent Comments