Go Down

Topic: Newbie (Read 6496 times) previous topic - next topic


These videos really helped me when I started programming for the Arduino:


(At the bottom you can click on "older posts" until you reach the first video of the tutorial).


As someone also learning to program the Arduino, I have a pet peeve.... the overuse of delay()!

Almost every book, website, and video series I've examined starts with the Blink sketch that uses delay() to time events, and never really goes past it. Even though the example sketches that come with the Arduino quickly move to a different style of programming (see Blink Without Delay and Debounce, which use the millis() timer), those books, websites, and videos keep using delay() instead.

It is simpler - but then using your emergency brake to control your car's speed is simpler than using the brake, gas, and shifter. And I think using delay() is akin to using your emergency brake to drive.

Study Blink Without Delay and Debounce, to start. Find videos about those sketches, and about using the millis() and micros() timers to time events.

And if a book, website, or video tells you to use delay() to debounce a button, stop reading or watching. That is a poor way to accomplish debouncing an input, it stops the action so nothing else can happen, and there are much better ways to do this.
Steve Greenfield AE7HD
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

Go Up