Learning Objectives

LO: Understand programming functions

LO: Understand how functions can be used to organise code


1.Create a program like the one shown below. What does it do?


(Click here for help)

2. Can you program Herbert to exercise when both buttons A and B are pushed?

Hint: Use the exercise function, roller skate icon, and A+B event handler.

3. Can you program Herbert to do a new action on shake?

4. One benefit of functions is writing code and then being able to reuse it easily. Look at the ASLEEP and DRINKING functions. What code is the same? Can you make a new function for this repeating code? Call your function BLINKING.