I need code to flashing LED by pulsein() function
I wrote the code but it doesn't work and the value of duration always is zero, why?
this is my code:
int LED = 10;
unsigned long duration;
unsigned long timeout=2000000;
void setup()
{
pinMode(LED, OUTPUT);
Serial.begin(9600);
}
void loop()
{
duration = pulseIn(LED, HIGH,timeout);
Serial.println(duration);
}
thank u