1 / 13

Lesson 3

Lesson 3. Sub-Routines. Lesson Objectives. To understand how to use values to control systems To understand what sub routines are, and how they are used to make control technology more efficient. . Task 1: Mobile. This mimic is a child's cot mobile. . It has 4 inputs. 3 buttons and a dial.

dutch
Download Presentation

Lesson 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lesson 3 Sub-Routines

  2. Lesson Objectives • To understand how to use values to control systems • To understand what sub routines are, and how they are used to make control technology more efficient.

  3. Task 1: Mobile • This mimic is a child's cot mobile. It has 4 inputs. 3 buttons and a dial It has 6 outputs. A motor which turns the mobile, and 5 lights/motors on each vehicle

  4. Values • At the top of a mobile is a dial. We can set it to different values from 0 to 100 which increment by 5 each time • How might we use this dial? What could we use it to control?

  5. Values • We can speed up the motor depending on the value of the dial above it.

  6. Task 1: • Create a flow diagram so that the motor goes forward at 20% when the value is equal to 10

  7. Task 2: • Make the motor turn faster as the value increases.

  8. Task 3: • Add 3 further flow diagram to program what will happen when the 3 buttons are pressed. • Remember there are several more outputs that you can include.

  9. Start Start Start Start Train from track 2? Train from track 3? Train from track 4? Train from track 1? These flow charts are used the control a railway crossing barrier. Light on Light on Light on Light on Light off Light off Light off Light off Light on Light on Light on Light on They all makes the lights flash before they close the barrier. Why is it inefficient to write the same command 4 times? Light off Light off Light off Light off Close Barrier 2 Close Barrier 3 Close Barrier 4 Close Barrier 1

  10. Extension: Sub Routines • Sub routines are used when the same flow chart is being used several times.

  11. Start Start Start SUB FLASH They work like this Train from track 2? Train from track 3? Train from track 1? Light on Each of the flow charts now includes a sub routine. This makes the flow chart more efficient. It saves time for the programmer and the computer. Light off SUB FLASH SUB FLASH SUB FLASH Light on Close Barrier 2 Close Barrier 3 Close Barrier 1 Light off Stop

  12. Sub routines in the mobile • Create a sub routine to program the lights and motors on the vehicles.

More Related