03 Mission Instructions

Your mission is to develop a robot that mimics how an animal responds to light in its environment.

For additional Biomimcry resources, check out the GoBox course summary page. 

5. Code: Program Your Animal

Let’s look back at your plan. You already decided what your animal would do in response to light and darkness. To turn this into code, you will be using a conditional statement. Conditional statements are how programmers tell robots to make decisions. “If you see light, then start dancing!”


To create this code, you need a green if-do-else block, found under Logic. You will then need to connect a sensor block to the if statement. We will be using the logic statement version of the sensor block, which can be found under "True or False" in the Sensors. Type in your threshold value right now. 20 is the default number in this block, but your threshold is probably a different number. 


STOP AND THINK - Order matters in a conditional statement. So let’s try saying it as a sentence using the orange sensor block exactly as it’s listed. If the light is less than twenty, then do________. Otherwise [else], do ________. 


So, if your robot is supposed to stay still when it is very dark and dance when it is very bright. Those sentences would sound like this:


If the light is less than twenty, then Stop GoPiGo

Otherwise [else], Move Forward, Turn Left, Turn Right, Move Backward.




You already made a plan for what your robot should do when the threshold is reached, so you are ready to fill in your own conditional statement


You might need to change the inequality sign too. When the “alligator mouth” is facing the number, it means less than. When the “alligator” is facing the words, it means greater than. Still not sure?  Dive in and program your robot with the block as-is. You can always change it later!