50 likes | 721 Views
Flowol subroutines. Subroutines are used to: Simplify your code to make it easier to read (or for someone else to read) Avoid having to write the same block of code a number of times Break a bigger problem into smaller steps. Flowol subroutines.
E N D
Flowol subroutines Subroutines are used to: Simplify your code to make it easier to read (or for someone else to read) Avoid having to write the same block of code a number of times Break a bigger problem into smaller steps
Flowol subroutines Subroutines are smaller programs which run inside larger programs Drag out a new START block Make the block a SUB Give the SUB a sensible name Code the SUB End with a STOP block
Flowol subroutines SubflashLights Turn red on Delay 1 second Turn blue on Delay 1 second Turn yellow on Delay 1 second Turn lights off Delay 1 second Stop You should be able to make the lights do more interesting flashing patterns than this As the Big Wheel rotates the lights need to flash on and off.
Flowol subroutines Start Is Input 1 on? If Yes Run Sub flashLights Turn Motor A Forward Loop back to Start If No Turn Motor A off Loop back to start How could you turn the lights off once they start flashing? Turning the wheel…
Flowol subroutines Key vocabulary: Subroutine Efficiency Loop Condition Pseudo Code