Loading...

for-loop part 3

Add 3 commands to your for loop so that the following happens:

  1. LED 1 is turned on, small pause, turn it off again, small pause.
  2. LED 2 is turned on, small pause, turn it off again, small pause.
  3. LED 3 is turned on, small pause, turn it off again, small pause.
  4. LED 4 is turned on, small pause, turn it off again, small pause.
Compile your program and test it out.

Now the other way around! Change the parameters in your for loop so that the following happens:

  1. LED 4 is turned on, small pause, turn it off again, small pause.
  2. LED 3 is turned on, small pause, turn it off again, small pause.
  3. LED 2 is turned on, small pause, turn it off again, small pause.
  4. LED 1 is turned on, small pause, turn it off again, small pause.
Compile your program and test it out.
1: How often is the initialisation in a for loop executed?
2: Can you change the order of the parameters?
 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…