ARDUINO PROGRAM FOR High Sensitive LDR based power saver for street light control system
#define light 3
int ldrPin=0;
#include <LiquidCrystal.h>
#define D4 6
#define D5 7
#define D6 8
#define D7 9
#define RS 11
#define EN 12
LiquidCrystal lcd(12, 11, 6, 7, 8, 9);
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(light, OUTPUT);
}
void loop()
{int sensitivity;
sensitivity= analogRead(ldrPin)/204.8;
Serial.print(sensitivity);
Serial.println(" volts");
if (sensitivity<=1.5)
{
digitalWrite(light, HIGH);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LIGHTS: ON");
}
else {
digitalWrite(light, LOW);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LIGHTS: OFF");
}}
#define light 3
int ldrPin=0;
#include <LiquidCrystal.h>
#define D4 6
#define D5 7
#define D6 8
#define D7 9
#define RS 11
#define EN 12
LiquidCrystal lcd(12, 11, 6, 7, 8, 9);
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(light, OUTPUT);
}
void loop()
{int sensitivity;
sensitivity= analogRead(ldrPin)/204.8;
Serial.print(sensitivity);
Serial.println(" volts");
if (sensitivity<=1.5)
{
digitalWrite(light, HIGH);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LIGHTS: ON");
}
else {
digitalWrite(light, LOW);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LIGHTS: OFF");
}}
No comments:
Post a Comment