VOCABULARY
STRUCTURE & SYNTAX
APPLICATIONS
PREDICT THE OUTPUT
FIX THE BUG
100

Which Arduino function returns the amount of time since the board started running?

millis()

100

What are the 3 sections in a for loop called?

Initialization, Condition, Update

100

Which type of loop is best to use when you know exactly how many times something should repeat?

For loop

100

If the button is NOT being pressed, what will happen after this section of code:

do{

digitalWrite(led, HIGH);

} while (digitalRead(button) == HIGH);

LED will turn on. (do while loops will always run once)

100

Find the error in the code below:

if(digitalRead(button) == HIGH){

motor.write(90)

delay(1000)

motor.write(180)

}

No semicolons were used

200

What variable type is used to hold a millis() value?

unsigned long

200

What operator checks if two values are equal?

==

200

Which type of loop is best when a program should continue running until a button is pressed?

While loop

200

What will the serial monitor say when this loop is finished running:

for(int i = 0; i < 5; i+=2){

Serial.println(i);

}

6

(First loop i = 0, second loop i = 2, third loop i = 4, fourth loop i = 6 which makes the condition false ending the loop)

200

Find the error in the code below:

for(int i = 0, i < 10, i++){

Used commas instead of semicolons to separate the sections of the for loop.

300

What unit of measurement represents the resistance in a circuit?

ohms

300

What is the correct format of a while loop?

while(condition){

//code to repeat

}

300

Which loop type is guaranteed to run at least once every time, regardless of whether a condition is met?

Do while loop

300

What will the LED look like if this is the void loop section of the code:

void loop(){

digitalWrite(led, LOW);

delay(1000);

digitalWrite(led, HIGH);

}

LED will be off

(No delay after digitalWrite(HIGH);)

300

Find the error in the code below:

while(brightness > 50){

tone(buzzer, HIGH);

delay(250);

noTone(buzzer);

}

Buzzers need to be set to a frequency rather than written high.

tone(buzzer, 200);

400

What does the != operator mean?

Not equal to

400

How would you create an infinite loop? 

Write a loop without updates/condition being re-checked

400

When would you check the millis() if you wanted to turn an LED on 5 seconds after a button is pressed?

Once when the button is pressed, and another time in the loop (constant).

400

How many times will the LED blink:

while(x<10){

digitalWrite(LED, HIGH);

delay(100);

digitalWrite(LED, LOW);

delay(100);

x = x + 2;

}

5 times

(x = x + 2 add 2 to the x variable each loop)

400

Find the error in the code below:

do (temp < 50){

digitalWrite(LED, HIGH);

} while;

The condition should come after the while, not the do.


do {

digitalWrite(LED, HIGH);

} while (temp < 50);

500

What is the main difference between long and unsigned long?

Unsigned long only holds positive large numbers. (Long holds both + and -)

500

What is the correct formatting of a do-while loop?

do{

//code to repeat

} while (condition);

500

What error would someone make to create an infinite loop?

Make a condition that is always true.

500

What will be printed to the serial monitor after this code runs?

if(digitalRead(button) == HIGH){

number = 31;

Serial.println("number");

}

The word "number"

500

Find the error in the code below:

while(x < 10){

x = 0;

motor.write(45);

delay(200);

motor.write(100);

delay(200);

x ++;

}

The condition is always true, making an infinite loop.