Programming a Move Procedure

Now we want to turn your algorithm into a reusable procedure - there are 5 columns on this grid and one measure of our success is for the program to work for ANY size grid

Find the Functions Block -

We use the term procedure, functions or methods interchangeably at this level of CS.

Click create a function and then title it moveDown - do not be distracted by the other options on the screen. And then hit done

Now to test it by calling the function. When you return to the Functions tab you should see 1 block - the call moveDown

TIP:When we use a function we are calling it

Test this code several times and make sure it is traversing each LED down the column. Do you need to adjust turns?

Last updated