IR blink sketch

Wondering if anyone knows of a way to do a simple blink sketch but control it with an IR remote

Hi there

You have put "delay(0020)" which delays for 20ms not 200ms. So the blink is too quick to see :slight_smile:

Try "delay(200)".

Hope you are enjoying working with the Arduino. If you decide to write bigger programs as your experience develops, look at the "blink without delay" example program. It shows a way of writing programs without needing delay() statements, which can cause problems as your programs get more complex (basically because they stop the Arduino doing anything else while waiting for the delay to finish). It can be applied to lots of programs, not just blinking LEDs.

All the best

Ray

You have put "delay(0020)" which delays for 20ms not 200ms. S

Nope, read it again. :wink:

AWOL:

You have put "delay(0020)" which delays for 20ms not 200ms. S

Nope, read it again.

What AWOL is getting to is if you precede a numeric value with a zero the compiler will interpret the rest of the digits as an octal value. So, 0020 would be interpreted as octal 020. Octal 20 converts to decimal 16. 16ms between the short blinks on is still too fast to differentiate the two blinks from each other.

Thank you, AWOL and Sembazuru :slight_smile: I've learned something new.

I don't think I've used octal since college, which is (mumble mumble mumble) years ago!

russkydeutsch:
after some research, I've answered my own question...

void loop() {

analogWrite(doublestrobe, 2);               //set off doublestrobe
analogWrite(doublestrobe, 200);         //set doublestrobe on
delay(90);
analogWrite(doublestrobe, 0);              //set doublestrobe off
delay(90);
analogWrite(doublestrobe, 200);         //set doublestrobe on
delay(90);
analogWrite(doublestrobe, 0);              //set doublestrobe off
delay(1100);
}

(I added code tags above...)

If that is what you want, but I really don't see why you need to use analogWrite(). I wouldn't think that one would want to PWM the led to a lower brightness to simulate a strobe (since strobes are very fast bright blinks).

Try (just for chuckles) this:

void loop()
{
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(50);                      // on for 50ms
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(100);                      // off for 100ms
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is voltage level)
  delay(50);                      // on for 50ms
  digitalWrite(led, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // off for 1s
}