Pages: [1]   Go Down
Author Topic: flash led doesn't work with pulsein() function  (Read 72 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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
Logged

Offline Offline
Edison Member
*
Karma: 36
Posts: 1212
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The pulseIn function reads an input. What is the signal that you are trying to read ?
http://arduino.cc/en/Reference/pulseIn

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank u, now I understand it
Logged

Pages: [1]   Go Up
Jump to: