Timers Flashcards

1
Q
  1. The millis() function returns the number of milliseconds since the Arduino board began running the current program.
    • True / False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. The micros() function returns the number of milliseconds since the Arduino board began running the current program.
    • True / False
A

False.
Answer: millis()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. The every() function in the timer library runs the callback function once after a specified duration.
    • True / False
A

False.
Answer: after()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. The update() function in the timer library must be called from the setup() function.
    • True / False
A

False
Answer: Must be called from the loop() function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. The oscillate() function in the timer library toggles the state of a digital output pin every specified period of time.
    • True / False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. The stop() function in the timer library stops timer events currently running.
    • True / False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. The repeatCount argument in the every() function specifies the number of times the callback function should be repeated.
    • True / False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. The millis() function overflows after approximately 70 minutes.
    • True / False
A

False
Answer: Overflows after approximately 50 days

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. 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) every(long period, callback)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  1. 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  1. Which function should be called from the loop function to service all the events associated with the timer?
    • a) every()
    • b) after()
    • c) stop()
    • d) update()
A

d) update()

16
Q
  1. How long does it take for the micros() function to overflow?
    • a) Approximately 70 seconds
    • b) Approximately 70 minutes
    • c) Approximately 70 hours
    • d) Approximately 70 days
A

b) Approximately 70 minutes

17
Q
  1. Which function is used to toggle the state of a digital output pin every specified period of time?
    • a) every()
    • b) after()
    • c) oscillate()
    • d) pulse()
A

c) oscillate()

18
Q
  1. What does the oscillate() function do?
    • a) Runs the callback once after a specified duration.
    • b) Toggles the state of a digital output pin every specified period of time.
    • c) Stops a timer event running.
    • d) Updates all the events associated with the timer.
A

b) Toggles the state of a digital output pin every specified period of time.

19
Q
  1. Which library is used for timer functions?
    • a) Timer.h
    • b) TimerLib.h
    • c) Timer.h library
    • d) timer.h
A

a) Timer.h

20
Q
  1. What function returns the number of milliseconds since the Arduino board began running the current program?
A

millis()

21
Q
  1. Name one function from the timer library used to run a callback function every specified period of time.
A
  • every()
  • after()
  • oscillate()
  • pulse()
22
Q
  1. What is the purpose of the oscillate() function in the timer library?
A

Toggles the state of a digital output pin every specified period of time.

23
Q
  1. How is the number of times a callback function should be repeated specified in the every() function?
A

By passing an additional argument for the repeat count.

24
Q
  1. What function should be called from the loop function to service all the events associated with the timer?
A

update()

25
Q
  1. How long does it take for the micros() function to overflow?
A

Approximately 70 minutes

26
Q
  1. Briefly describe the purpose of the pulse() function in the timer library.
A

Toggles the state of a digital output pin just once after a specified duration.

27
Q
  1. What is the function of the stop() function in the timer library?
A

Stops a timer event running

28
Q
  1. What function is used to toggle the state of a digital output pin just once after a specified duration?
A

pulse()

29
Q
  1. Which Arduino library provides timer functions for managing timed events in a sketch?
A

Timer.h