So.. i'm making a project that involves reading a state of a LED that is attached to a lithium battery (12V 280Ah). This LED turns on for 1 second, then turn off for another second, when i'm charging the battery this LED keeps blinking until the battery reaches full charge, then its fully on. I've already manage to setup a LDR and read the LED state, the arduino knows when its on and when its off.
Making the board understand that the LED is on and take some action is easy, the hard part is the blinking one.I need help to make a code that reads the blinks and do nothing, then reads the LED fully on and activates a relay. I'm not looking for someone to just write the code and done, i need just some directions like wich functions i should use.
I can't access the internals of the battery to hook the board directly into the wires of the LED.
I've tried the LDR in an analog pin, gave me results betwen 40 (LED off) and 730 (LED on), the LDR also worked as digital input returning 0(LED off) and 1(LED on).
Also i'm not posting the code because there's none yet, all the code that i've used in tests was lost.