Skip to main content

Reply to "Arduino Lesson: Millisecond Timing"

Using the MsTimer class library, we can now modify the "blink" sketch as follows:

b

The "delay" in the setup function ensures that the millisecond timer value does not produce a 0 from the call to "millis". If the timer is started with a value of 0, it will appear that the timer has completed even before it is started. But in the loop, we take advantage of this notion by testing the initial timer which will be "done" before ever being started. That gets the LED blinking started. Then we begin the one second timer that occurs before the LED changes to its alternate state.

Attachments

Images (1)
  • mceclip0

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×