Pages: [1]   Go Down
Author Topic: Simple LED Blink example  (Read 7634 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello guys, I wrote an article about the simple LED blink example with some more information. If you can check it out for any errors and please suggest anything that I could possible add. Thanks and I hope it helps...

http://greekorio.com/wordpress/arduino-project-led-blink/
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26465
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know about "add", but I'd prefer it if you subtracted delay().
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

I don't know about "add", but I'd prefer it if you subtracted delay().

Subtracted to what? smiley-neutral
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26465
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Subtracted to not using delay at all
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 656
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The voltage drop of a Led depends a lot on the colour it emits.  Some diodes may have a 0.7 voltage drop, but leds usually have a much higher voltage drop. For infra-red leds it's about 1.8 volts,  UV can be close to 4volt.

There's little harm in using a resistor with a higher value as needed, but a red diode (~2v)  will shine much brighter as a blue one (~3.2v) when you use the same value resistor.
Logged

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

I don't really mind the delay in your code actually, especially since it is code meant for beginners, and the page looks pretty neat, but if you want to know how to do it without delay for your code, check this Arduino page:

http://arduino.cc/en/Tutorial/BlinkWithoutDelay
Logged

Shelby Township, Disco, Michigan
Offline Offline
God Member
*****
Karma: 26
Posts: 766
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

delay(150);               // wait for 150 ms

Is not 1 second. smiley
Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 162
Posts: 2428
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I would have to ask what content you've provided beyond what is on the Blink page here:
http://arduino.cc/en/tutorial/blink

Teaching beginners to use delay() to time tasks is, IMO, like teaching beginning drivers to use the emergency brake to drive your car.

It is not scalable, everything stops during the delay(), and to do anything more complicated than blink an couple of LEDs, they'll have to relearn and ignore what they just learned.

I really wish they would take that Blink sketch out of the Arduini IDE examples. Almost every book on Arduino programming starts with that, ignores the Blink Without Delay and Debounce examples, and proceeds to use delay() to do the rest of their book.

If I want synchronized LEDs, I can wire up a 555 timer and a 4017. I can even change the timing from LED to LED with the use of some extra parts. But I can't make them blink out of the previous order. This is why I am learning to program, and using delay() can only blink those LEDs in the same order.

On your next example, you said:

Quote
V= applied voltage almost 5V minus 0.7 V (approx voltage drop due to diode)

This is incorrect. 0.7V is the voltage across a standard silicon diode. An LED drops more voltage, dependent on the color and construction. Infrared LEDs drop about 1.5V, red about 2V, yellow and amber a bit more, green more than that, etc.

I also notice you are still using delay() to time things.

My suggestion would be to learn how to use other methods of timing events. Study Blink Without Delay and Debounce. Write articles about using those, and take down the articles about Blink.
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

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

Thank you for the feedback. Appreciate that...
Logged

Pages: [1]   Go Up
Jump to: