Pages: 1 ... 4 5 [6]   Go Down
Author Topic: Sticky - Blink Two LEDs, independent, no delay  (Read 6002 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 1
Posts: 415
MEGA_Stick_II is here
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This might be a better solution smiley-wink (at least for more complicated issues)

http://www.element14.com/community/message/40256#40256/l/event-driven-state-machine-framework-for-arduino
« Last Edit: November 21, 2011, 01:06:17 pm by Jassper » Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 4710
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 In changing the title and in writing the explanation keep in mind that the most important concept here is the fact that the code is implementing a 'delay' without using the 'delay()' function.  The fact that one or more LEDs are blinking is not really what this is all about.

The blinking of an LED is an example of what can be done with any kind of delay technique.  The blinking of an LED while also doing something else is an example of what can be done when the use of delay() is eliminated, as is the independent blinking of two LEDs.

It also helps introduce how to handle/work with asynchronous events which to my mind is the crux of loop().

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 32
Posts: 1202
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In my mind the reason for this "sticky" was to extend the Blink without delay() tutorial to two LEDs. Thus the explanation of avoiding using delay() is assumed covered. This was to help make the mental leap from the single LED to the general case. (Some people cant even make the leap from a LED to a motor ...)

No, it is not a complete example on the "best" way to blink a LED. No, it wasnt an example on how to implement polled multithread programming.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4255
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Thus the explanation of avoiding using delay() is assumed covered.
Just make sure that if the word 'delay' is used in the title that it includes the parentheses.  Actually it would probably be better to indicate what is being used rather than what is not being used.  How about 'Blink Two LEDs independently without blocking' or 'Blink Two LEDs independently using millis()' ?

Don
Logged

Pages: 1 ... 4 5 [6]   Go Up
Jump to: