0% found this document useful (0 votes)
6 views2 pages

Codes and Program Uploaded

The document contains two sets of code for Arduino projects: one for an IR sensor that counts people entering and exiting a space, and another for remote control of two lights using an IR remote. The first code uses an LCD to display the number of people inside, while the second code controls the lights based on specific IR signals. Both programs utilize libraries for LCD and IR functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Codes and Program Uploaded

The document contains two sets of code for Arduino projects: one for an IR sensor that counts people entering and exiting a space, and another for remote control of two lights using an IR remote. The first code uses an LCD to display the number of people inside, while the second code controls the lights based on specific IR signals. Both programs utilize libraries for LCD and IR functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CODES AND PROGRAM UPLOADED

CODES AND PROGRAM FOR IR SENSOR delay(1200);


digitalWrite(irSensorOutPin, HIGH);
#include <Wire.h> }
#include <LiquidCrystal_I2C.h> if (digitalRead(irSensorInPin))
{ state = true;
int irSensorInPin = 2; delay(20);
int irSensorOutPin = 3;
int buzz = 12; } if (!digitalRead(irSensorOutPin) && state) {
int ledPin = 5; personCount--; // Decrement person count
if (personCount < 0)personCount = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2); state = false;
digitalWrite(buzz, HIGH);
int personCount = 0 ; delay(300);
boolean state = true; digitalWrite(buzz, LOW);
void welcomeMessage() { [Link](8, 1);
[Link](); [Link](personCount);
[Link](); digitalWrite(irSensorInPin, LOW);
[Link](); delay(1200);
[Link](1, 0); digitalWrite(irSensorInPin, HIGH);
[Link]("WELCOME YZA!"); delay(20);
delay(1500); }
[Link](0, 1); if (!digitalRead(irSensorOutPin))
[Link]("HAVE A NICE DAY!"); { state = true;
delay(2000); delay(20);
} }
if (personCount > 0) {
void setup() { digitalWrite(ledPin, HIGH);
welcomeMessage(); }
[Link](); else
[Link](); {
[Link](1, 0); digitalWrite(ledPin, LOW);
[Link]("PEOPLE INSIDE:"); }
[Link](8, 1); }
[Link](personCount);
pinMode(irSensorInPin, INPUT);
pinMode(irSensorOutPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzz, OUTPUT);
}

void loop() {

if (!digitalRead(irSensorInPin) && state) {


personCount++;
if (personCount > 9)personCount = 9;
state = false;
digitalWrite(buzz, HIGH);
delay(300);
digitalWrite(buzz, LOW);
[Link](8, 1);
[Link](personCount);
digitalWrite(irSensorOutPin, LOW);
CODES AND PROGRAM UPLOADED

CODES AND PROGRAM FOR REMOTE CONTROL


#include <IRremote.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

IRrecv IR(11);
int Light1 = 2;
int Light2 = 4;

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
[Link]();
pinMode(Light1, OUTPUT);
pinMode(Light2, OUTPUT);

[Link](9600);

[Link]();
[Link]();
[Link](0, 0);
[Link]("Light1: ");
[Link](0, 1);
[Link]("Light2: ");
}

void loop() {
if ([Link]()) {
[Link]([Link], HEX);

if ([Link] == 0xBA45FF00) {
digitalWrite(Light1, HIGH);
[Link](8, 0);
[Link]("ON ");
}
else if ([Link] ==
0xBB44FF00) {
digitalWrite(Light1, LOW);
[Link](8, 0);
[Link]("OFF");
}
else if ([Link] ==
0xB946FF00) {
digitalWrite(Light2, HIGH);
[Link](8, 1);
[Link]("ON ");
}
else if ([Link] ==
0xBF40FF00) {
digitalWrite(Light2, LOW);
[Link](8, 1);
[Link]("OFF");
}
delay(100);
[Link](); // Resume IR receiver
}
}

You might also like