Question

Implement the luminosity control of a street lighting lamp which has 3 different levels of intensity according to the le...

Implement the luminosity control of a street lighting lamp which has 3 different levels of intensity according to the level of darkness. Using Arduino


the question is complete, it is a luminosity controller for a led with 3 levels of brightness.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#define LIGHT_IN A0
//using the Light Dependent Resistor output to analog pin A0

#define LED_CONTROL 5
//led control pin in digital pin 5

#define DARK_LEVEL_1 340
//too dark

#define DARK_LEVEL_2 780
//medium dark

#define DARK_LEVEL_3 1024
//bright room

#define INT_LEVEL_1 85
//low intensity for led

#define INT_LEVEL_2 170
//medium intesity for led

#define INT_LEVEL_3 255
//high intensity for led

void setup()
{
   pinMode(LED_CONTROL, OUTPUT);
   //setting the LED_CONTROL(PWM) pin as output pin
}

void loop()
{
   float val = analogRead(LIGHT_IN);
   //read the analog pin A0 value to get the light luminosity
  
   if(val < DARK_LEVEL_1)
   {
       analogWrite(LED_CONTROL, INT_LEVEL_3);
       //if it's too dark, then glow the led with maximum brightness
   }
   else if(val < DARK_LEVEL_2)
   {
       analogWrite(LED_CONTROL, INT_LEVEL_2);
       //if it's medum dark, then glow the led with medium brightness
   }
   else
   {
       analogWrite(LED_CONTROL, INT_LEVEL_1);
       //if it's too bright, then glow the led with minimum brightness
   }
}

$ Anduino ChND Ok 5T AO LEO GND LDR ww

Add a comment
Know the answer?
Add Answer to:
Implement the luminosity control of a street lighting lamp which has 3 different levels of intensity according to the le...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT