Loading...

IR-sensor part 2

Your programme is now going to be changed so that the eyes light blue when there is little reflection and red when there is more.

To do this we're going to add to line 17 an
else if check.

The compiler works like this:

it checks the condition in line 13.
if it is true, line 14 is executed.

if it is false, the condition in line 17 is processed.
if this is then true, line 18 is executed.

if this is then false, line 22 is executed.

Your programme is now going to be changed so that the eyes light blue when there is little reflection and red when there is more. If there is no reflection, the eyes should stay off.

Add the missing condition to line 17.

Add the missing command to line 18.

Compile your program and test it on your BOB3!
1: What happens if you change the condition irValue > 8 in line 13 to 8 == 8?
 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…