This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
starting:examples:trafficlights [2017/10/04 06:37] simplesi |
starting:examples:trafficlights [2017/10/04 10:29] (current) simplesi [Better Method] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Traffic Lights ====== | ====== Traffic Lights ====== | ||
- | Writing Traffic Light simulators is a excellent educational tool | + | Coding a Traffic Light simulator is a excellent educational project |
- | Programmers can start off simply by just creating one traffic light | + | You can start off by just creating one traffic light |
- | Once that has been achieved, programmers can go onto extra tasks such as turning it into a pedestrian crossing simulator and adding a red/green person (or walk/dont walk) light | + | Once that has been achieved, you can go onto extra tasks such as turning it into a pedestrian crossing simulator and adding a red/green person (or walk/dont walk) light |
Then a button can be added - then a wait light - and beeping sound etc | Then a button can be added - then a wait light - and beeping sound etc | ||
Line 12: | Line 12: | ||
It is a classic //**low barrier for entry - high ceiling**// project | It is a classic //**low barrier for entry - high ceiling**// project | ||
- | ===== Starting Off ===== | + | ===== Example ===== |
- | [[http://gpblocks.org/forum/download/file.php?id=302&sid=97a9b0d5292ff7fe490e5c1418991c5f|Example]] | + | [[http://gpblocks.org/forum/download/file.php?id=304&sid=81c1fd9fdb885c10d64be3b0ff024cbc|Download program]] |
+ | {{:starting:examples:traffic:screen00.png |}} | ||
+ | |||
+ | |||
+ | |||
+ | ===== Better Method ===== | ||
+ | The version above contains the least blocks necessary to simulate a traffic light but isn't necessarily the best way to go about it. | ||
+ | |||
+ | By adding in some broadcast blocks, the program becomes easier to understand and easier to debug if a mistake is made | ||
+ | {{:starting:examples:traffic:screen0.png |}} | ||
+ | |||
+ | |||