Download presentation
Presentation is loading. Please wait.
Published byMarshall Thompson Modified over 9 years ago
1
www.bluesquarething.co.uk/kthree/flowol.htm 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
2
www.bluesquarething.co.uk/kthree/flowol.htm 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
3
www.bluesquarething.co.uk/kthree/flowol.htm Flowol subroutines As the Big Wheel rotates the lights need to flash on and off. Sub flashLights 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
4
www.bluesquarething.co.uk/kthree/flowol.htm Flowol subroutines Turning the wheel… 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?
5
www.bluesquarething.co.uk/kthree/flowol.htm Flowol subroutines Key vocabulary: Subroutine Efficiency Loop Condition Pseudo Code
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.