Blinking 1

Now you’re going to make one of the eyes flash!

To do this, we need a new function:

loop() {


The statements in between the braces {...} in loop() are repeated automatically.

Our example here has a new statement:


The statement “delay(500);” tells BOB3’s microcontroller to wait 500 milliseconds, i.e. 0.5 seconds.

In line 8, eye 1 is lit in white:
bob3.setLed(EYE_1, WHITE);

Then 500 milliseconds pass:

Then eye 1 is turned off:
bob3.setLed(EYE_1, OFF);

Then another 500 milliseconds pass:

then we go back to line 8...

Compile the new program and transfer it over to your BOB3..

If everything has worked correctly then eye 1 should be flashing!

What do you think would happen if you changed the value 500 in delay()?

Try changing it to 200, compile your program and transfer it onto your BOB3.

What difference do you notice?

What happens if you change the number to 1000?

1: What does the statement delay(1000); do?
2: What happens if you put all of the statements in setup() instead of loop()?
 You haven’t completed anything yet!
 Super, so far so good…
 Super, you got it all right!
 Sadly not correct…
 One answer is correct
 A couple are correct…