Computing KS1 / KS2: Creating a simple automated driving simulator

A primary school class is using Scratch visual programming language to code instructions to make a car race around a track, helped by science presenter Minna Kane.

They first draw the track using paint tools, then pick a car “Sprite”, or icon, to instruct to drive around it.

They paint the headlights of the car different colours, and use IF/THEN commands in a FOREVER loop to tell the car to change direction if the headlight colour meets the background colour at the edge of their track.

In this way, they can tell their car to stay on the road.

They enter speed as a variable, and find that at higher speeds it is harder for the car to stay on the track, as the program has less time to react.

They lower the speed to debug the program.

Minna Kane wonders if speed is the only parameter that would affect the program like this, and encourages viewers to experiment themselves.

This clip is from the series Cracking the Code.

Teacher Notes

This could be used across a number of curriculum objectives: design and write programs that accomplish specific goals, including simulating physical systems, working with variables and to show the use of selection and repetition in programs.

It could also be used to demonstrate how a simple algorithm works.

Curriculum Notes

This clip will be relevant for teaching Computing at KS1 and KS2 in England, Wales and Northern Ireland and Computing Science and ICT at Second Level in Scotland.

More from the series Cracking the Code

Computing KS1 / KS2: Programming a robot crocodile
video
Computing KS1 / KS2: Creating computer generated visual effects
video
Computing KS1 / KS2: Programming a computer game
video
Computing KS1 / KS2: Programming a robotic toy car
video
Computing KS1 / KS2: Programming robots to play football
video
Computing KS1 / KS2: Simulating the experience of F1 racing
video
Computing KS1 / KS2: Programming a webcam
video
Computing KS1 / KS2: What are bitmap graphics?
video