0

i want to know code for counting the flashes of LEDs and display no. of flashes in particular time given.by using LDR. basically i tried it with interrupts but i'm not getting it,so please help in this regard.

asked Mar 1, 2016 at 13:57
1
  • If you post the code of your attempt, we might be able to help you. Commented Mar 1, 2016 at 15:39

2 Answers 2

0

An hardware solution could be achieved by putting a photodiode or a photoresistance near the flashing LED. Connect it to a pin that supports external interrupt and you're done. With a bit more circuitry you can ensure that the value on the pin doesn't oscillate: put a Schmit Trigger after the photodiode or resitance with its output on the input pin.

answered Mar 1, 2016 at 18:52
1
  • The Arduino Uno already has Schmitt triggers on all its digital inputs. C.f. figure 14.2 on page 76 of the ATmega328P datasheet. Commented Mar 2, 2016 at 9:31
1

LDRs only give an analog output, proportional to the amount of light.

To make it give a HIGH and LOW value, you have to tweak the other resistor used in the voltage divider.

Alternatively you could use analogRead and add a threshold value in your code.

answered Mar 1, 2016 at 15:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.