Detecting the LED is blinking or constantly on

Hi.
I have a Bluetooth audio transmitter that when it is connected to a device, its LED is constantly on, and if it is searching for a device, its LED blinks.

What code should I write so that my Arduino can detect that the LED is blinking or constantly on?

Thanks a lot

What code do you have so far?

How does your program determine if the LED is on or off, that is how are you getting the key piece of information for your logic?

a7

1 Like

Hello rubike
Take a view to get some ideas.
https://create.arduino.cc/projecthub/tarantula3/using-an-ldr-sensor-with-arduino-807b1c
Have a nice day and enjoy coding in C++.

I don't have any codes.
I want to do this project using some functions such as digitalRead , pulseIn , millis and etc.

Thank you but I don't want to use LDR sensor.
I want to do this project without any sensors.

Okay, and how do you propose to do that? Have you seen anywhere, some method of detecting light digitally that does not utilize a sensor?

You will have to hardwire to the Bluetooth device if you do not use a sensor. I would suggest using the sensor so you don't have to modify the bluetooth device.

1 Like

Is it possible to do this without a sensor?
That is, connect wires to the LED pins to one of the Arduino digital pins, and use the Arduino digital pins to detect the LED is blinking or it is constantly on.

Yeah, if you know what you are doing.

Do you have a schematic of the device whose LED you want to hijack?

Any measurements around the circuitry involved with the LED?

Any problem with burning out the device(s) you working with?

a7

There are four possible configurations for LED drive, common ground or common V+, resistor first or LED first. Also you have to consider the LED forward voltage drop.

Are you comfortable with reverse engineering to find out? Then soldering jumpers to tiny little SMD pads? Risking uncontrollable ground current loops?

Or it might be at a matrix cross point or it could be a smart LED.

Point is, until you know, tinkering is fraught.

a7

1 Like

In the meantime, you can work on the software, just use a pushbutton as proxy for the signal you have yet to develop that will come from the real LED.

So write some code with the pushbutton standing in for the LED to be hijacked.

We can help you with that, and the other thing too.

a7

One would have to meet at least three conditions to do this:

  1. the Arduino common (aka ground) would have to be the same as that of the LED circuit.
  2. the LED voltage would have to be matched to the Arduino's input voltage capability.
  3. the two above cannot compromise the function of the LED and LED's circuit

1.No
2.No
3.No

So, perform #2 and get back to us.

could you help me to write that code?
I'm beginner

That is not going to happen. This is a self help forum. One good idea, would be to simply create a logical definition of what constitutes "blinking" and "continuously on". Then code it.

Also, it's doubtful that you can complete the hardware interface.

No thanks. Happy to help you with anything you come up with, or watch someone else write it for you.

Have you worked through any of the examples sketches in the IDE?

a7

Yes,of course.

Let's play a game. I show you a photograph of a light bulb. It looks like it's on. Is it blinking? Or is it on continuously?

I show you another one, taken one minute later. It looks like it's off. Answer the same questions.

Under what conditions could you be sure? :slight_smile:

What if someone liked to turn the light on and off a lot?
What if it was blinking, but really slowly?