user61347: I have a device that has one blinking LED.
I want to count the number of blinks. I planned to do it using Arduino. I will connect two terminals of LED input to Arduino digital input pins, and I will count the number of positive voltage pulses
I just want to know if it is possible? and if yes then can you please hint the code for the same?

user31105: You should not count the number of pulses, but the number of transition from 0 to VCC volts or VCC to 0 volts (called rising resp. falling edge).
If you don't want to solder, you can also use a light dependent resistor (LDR) very close by the LED to measure the difference in brightness. See also chrisl's remark below.
The counting you can do manually (in a loop, check as often as possible or needed), or by setting up a timer to check for either rising or falling edges.
I will give the pseudo code so you can figure out the actual code:
bool _ldrPin;
unsigned long int _counter;


setup()
{
   // Set Serial
   Serial.begin(9600);

   // Set LDR
   setAnalogPin(X, INPUT);
   _ldrPin = readAnalog(X);
}

loop()
{
    if (!_ldrPin && readAnalog(X) == HIGH)
    {
        // Rising edge, increase counter
        _counter++;
        Serial.Write(_counter);
        _ldrPin = true;
    }
    else if (ldrPin && readAnalog(X) == LOW)
    {
       // Falling edge, reset status
        _ldrPin = false;
    }
}


user19409: Detecting the LED Pulses
You want to detect each LED pulse. For this you will need edge detection code. There is an Arduino example built into the IDE and information describing the function here: https://www.arduino.cc/en/Tutorial/BuiltInExamples/StateChangeDetection
To add to the Arduino explanation, you can either detect the rising edge (ie. the transition from a LOW to a HIGH) or the falling edge (ie. the transition from a HIGH to a LOW). I personally prefer the following code to detect a rising edge. In simple terms the code can be translated to this:
if ( (lastLedState == LOW) && (ledState == HIGH) )

where ledState would be assigned by a digitalRead and lastLedState would record the value of ledState at the end of the loop function (ie. just before it reads in the led states again).
Full Code
Now if we optimise the above statement and put it into context:
unsigned long int pulseCounter = 0;
const int LedInput = 3;    // Digital input 3
bool ledState = 0;
bool lastLedState = 0;

void setup() {
    
}

void loop() {
    ledState = digitalRead(LedInput);
    
    // If the LED turns ON
    if (ledState && !lastLedState)
    {
        // Increment your counter
        pulseCount++;
    }
    
    // Update LED flag
    lastLedState = ledState;
}


61347: <p>I have a device that has one blinking LED.</p>
<p>I want to count the number of blinks. I planned to do it using Arduino. I will connect two terminals of LED input to Arduino digital input pins, and I will count the number of positive voltage pulses</p>
<p>I just want to know if it is possible? and if yes then can you please hint the code for the same?</p>
 31105: <p>You should not count the number of pulses, but the number of transition from 0 to VCC volts or VCC to 0 volts (called rising resp. falling edge).</p>

<p>If you don't want to solder, you can also use a light dependent resistor (LDR) very close by the LED to measure the difference in brightness. See also chrisl's remark below.</p>

<p>The counting you can do manually (in a loop, check as often as possible or needed), or by setting up a timer to check for either rising or falling edges.</p>

<p>I will give the pseudo code so you can figure out the actual code:</p>

<pre><code>bool _ldrPin;
unsigned long int _counter;


setup()
{
   // Set Serial
   Serial.begin(9600);

   // Set LDR
   setAnalogPin(X, INPUT);
   _ldrPin = readAnalog(X);
}

loop()
{
    if (!_ldrPin &amp;&amp; readAnalog(X) == HIGH)
    {
        // Rising edge, increase counter
        _counter++;
        Serial.Write(_counter);
        _ldrPin = true;
    }
    else if (ldrPin &amp;&amp; readAnalog(X) == LOW)
    {
       // Falling edge, reset status
        _ldrPin = false;
    }
}
</code></pre>
 19409: <h1>Detecting the LED Pulses</h1>
<p>You want to detect each LED pulse. For this you will need <strong>edge detection code</strong>. There is an Arduino example built into the IDE and information describing the function here: <a href="https://www.arduino.cc/en/Tutorial/BuiltInExamples/StateChangeDetection" rel="nofollow noreferrer">https://www.arduino.cc/en/Tutorial/BuiltInExamples/StateChangeDetection</a></p>
<p>To add to the Arduino explanation, you can either detect the rising edge (ie. the transition from a LOW to a HIGH) or the falling edge (ie. the transition from a HIGH to a LOW). I personally prefer the following code to detect a rising edge. In simple terms the code can be translated to this:</p>
<pre><code>if ( (lastLedState == LOW) &amp;&amp; (ledState == HIGH) )
</code></pre>
<p>where <code>ledState</code> would be assigned by a <code>digitalRead</code> and <code>lastLedState</code> would record the value of <code>ledState</code> at the end of the loop function (ie. just before it reads in the led states again).</p>
<h1>Full Code</h1>
<p>Now if we optimise the above statement and put it into context:</p>
<pre><code>unsigned long int pulseCounter = 0;
const int LedInput = 3;    // Digital input 3
bool ledState = 0;
bool lastLedState = 0;

void setup() {
    
}

void loop() {
    ledState = digitalRead(LedInput);
    
    // If the LED turns ON
    if (ledState &amp;&amp; !lastLedState)
    {
        // Increment your counter
        pulseCount++;
    }
    
    // Update LED flag
    lastLedState = ledState;
}
</code></pre>
