Arduino Tutorial: Flicker a LED by TXTCLA55
Tired of all those other instructables about how to blink a LED? well how about flickering a LED? eh? there is a ible all about flickering a LED.
 
Remove these adsRemove these ads by Signing Up
D5quar3 says: Jun 19, 2010. 2:59 PM
This code is a lot easier it might not look as nice but i uploaded the code and it didn't work here is mine int ledPin = 13; // LED connected to digital pin 13 // The setup() method runs once, when the sketch starts void setup() { // initialize the digital pin as an output: pinMode(ledPin, OUTPUT); } // the loop() method runs over and over again, // as long as the Arduino has power void loop() { digitalWrite(ledPin, HIGH); // set the LED on delay(35); // wait a thirty-fifth of a second digitalWrite(ledPin, LOW); // set the LED off delay(35); // wait a thirty-fifth of a second }
Microbe says: May 2, 2011. 8:08 PM
@D5quar3, but your code is only flashing. The original does work and although the randomness could be improved it does "flicker"
oweng4000 says: Jul 9, 2010. 1:06 PM
#include void setup(){ } void loop(){ analogWrite(9, TrueRandom.random(0,255)); delay(10); } this is the code I used it requires the TrueRandom library(http://code.google.com/p/tinkerit/wiki/TrueRandom), but the result is rather convincing.
gotcha99 says: Dec 23, 2009. 8:18 AM
Hey there from Germany.
I've got a problem.
After about 3 seconds the LED stops lighting.
Then after about ten seconds it lights again for about 2 minutes.
After that, the same thing starts again!

I'm using an 220 Ohm resistor to not to destroy the LED.
I used the code from above without editing it (only the delay = 75ms).

Can anybody help me???
Thanks, gotcha99
d-lite says: May 11, 2009. 11:53 AM
Are you putting the LED directly across the 5-volt output? Hopefully you are lucky enough for the LED to blow before the Arduino gets wrecked!
Derin says: May 23, 2009. 8:54 PM
It would be better to use 13 since there is a LED on the board for Duemilanove and Diecimila.I use that when I need to led there be light.
TXTCLA55 (author) says: May 24, 2009. 1:28 PM
No. Pin 13 may be a better choice, and you can edit the code if you like so the led can flash through there, but if you use a 1k resisor before the LED on pin 11 you will be fine.
TXTCLA55 (author) says: May 11, 2009. 4:30 PM
dont worry. just make sure u use a 5 volt led or a resistor.
ReCreate says: Jun 26, 2009. 11:03 AM
there is no such 5 volt led...any 5v leds just have a tiny resistor in them...
ajitam says: May 11, 2009. 12:09 PM
yeah I think 13 pin is more wise choise
qs says: May 11, 2009. 12:38 PM
The sketch will not run properly on pin 13 - it needs a PWM port for the 'flicker'. Make sure you put a 180-330 ohm resistor before the LED to protect it and the Arduino, which is only rated for 40mA before it's zapped!
TXTCLA55 (author) says: May 11, 2009. 4:26 PM
thanks for clearing this up. I first tried the sketch with a 1.5 volt LED....sparks flew! The one in the pictures is actualy rated for 5 volts so it needs no resistor.
ajitam says: May 11, 2009. 1:45 PM
if I understand correctly this is because we putting analog output ?
TXTCLA55 (author) says: May 11, 2009. 4:27 PM
correct. but the analog is actually a list of different frequencies rather than physical input.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!