Timers Flashcards
1
Q
- The
millis()
function returns the number of milliseconds since the Arduino board began running the current program.- True / False
A
True
2
Q
- The
micros()
function returns the number of milliseconds since the Arduino board began running the current program.- True / False
A
False.
Answer: millis()
3
Q
- The
every()
function in the timer library runs the callback function once after a specified duration.- True / False
A
False.
Answer: after()
4
Q
- The
update()
function in the timer library must be called from thesetup()
function.- True / False
A
False
Answer: Must be called from the loop()
function
5
Q
- The
oscillate()
function in the timer library toggles the state of a digital output pin every specified period of time.- True / False
A
True
6
Q
- The
pulse()
function in the timer library toggles the state of a digital output pin just once after a specified duration.- True / False
A
True
7
Q
- The
stop()
function in the timer library stops timer events currently running.- True / False
A
True
8
Q
- The
repeatCount
argument in theevery()
function specifies the number of times the callback function should be repeated.- True / False
A
True
9
Q
- The
after()
function in the timer library runs the callback function every specified period of time.- True / False
A
False
Answer: Once after a specified duration, not repeatedly at a specified period of time
10
Q
- The
millis()
function overflows after approximately 70 minutes.- True / False
A
False
Answer: Overflows after approximately 50 days
11
Q
- What does the
millis()
function return?- a) The number of microseconds since the Arduino board began running the current program.
- b) The number of milliseconds since the Arduino board began running the current program.
- c) The number of milliseconds since the Arduino board was manufactured.
- d) The number of microseconds since the Arduino board was manufactured.
A
b) The number of milliseconds since the Arduino board began running the current program.
12
Q
- Which function is used to run a callback function every specified period of time?
- a)
every(long period, callback)
- b)
after(long duration, callback)
- c)
oscillate(int pin, long period, int startingValue)
- d)
pulse(int pin, long period, int startingValue)
- a)
A
a) every(long period, callback)
12
Q
- How long does it take for the
millis()
function to overflow?- a) Approximately 50 minutes
- b) Approximately 50 hours
- c) Approximately 50 days
- d) Approximately 50 weeks
A
c) Approximately 50 days
13
Q
- What is the purpose of the
pulse()
function?- a) To toggle the state of a digital output pin every specified period of time.
- b) To stop a timer event running.
- c) To update all the events associated with the timer.
- d) To toggle the state of a digital output pin just once after a specified duration.
A
d) To toggle the state of a digital output pin just once after a specified duration.
14
Q
- How do you specify the number of times a callback function should be repeated in the
every()
function?- a) By passing an additional argument for the repeat count.
- b) By using the
repeatCount
keyword. - c) By calling the
repeat()
function inside the callback. - d) By setting a global variable.
A
a) By passing an additional argument for the repeat count.