delayMicroseconds not working on my Arduino Uno?

Hi all,

I noticed that the function delayMicroseconds does not work (properly) on my Arduino Uno. It seems like the program skips the command altogether. For instance, in this simple program:

const int ledPin = 12;

void setup() {

  pinMode(ledPin, OUTPUT);
}

void loop() {
  
  digitalWrite(ledPin, HIGH);
  delayMicroseconds(500000);
  digitalWrite(ledPin, LOW);
  delayMicroseconds(500000);
  
  /*
  digitalWrite(ledPin, HIGH);
  delay(500);
  digitalWrite(ledPin, LOW);
  delay(500);
  */
}

the LED lights up at half capacity, as if it had a duty cycle of 50% (as you would expect when delayMicroseconds is being skipped). The normal delay function (in comments) works fine. A value of 500 ms in the delay function should be equivalent to 500000 µs in delayMicroseconds function, right? Anyone an idea what might be wrong?

Anyone an idea what might be wrong?

Yes, the delayMicroseconds() function is written to except a unsigned integer value. A value of 500000 will not fit into a integer. Here is the reference page for that function:
http://arduino.cc/en/Reference/DelayMicroseconds

Lefty

Ah, guess I didn't read the reference page thoroughly. Thanks!