Logic and computer systems · GCSE · OCR J277 1.1.3, AQA 8525 3.4.5, Edexcel 1CP2 3.1.3 · about 15 min
What makes a system embedded, the robot's three boards, and the sense-decide-act loop.
[1 mark]What is an embedded system?
[1 mark]Which is an embedded system?
[1 mark]Which is typical of an embedded system?
[1 mark]Put the steps of the control loop in order.
Number the lines 1 to 3 to put them in the right order.
Decide: work out what to doAct: set the outputsSense: read the inputs[1 mark]What does this program print?
gap = 15
if gap < 20:
action = "stop"
else:
action = "drive"
print(action)There is a wall ahead. Write a sense-decide-act loop that drives the robot forward slowly. Each time round: sense the distance; decide; act. While the gap is 20 cm or more, keep driving with a green LED. When it is under 20 cm, stop, turn the LED red, play a tone, and end the loop. Do not hit the wall.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect()
Plan your program here, then type it in and press Run.
battery() that stops everything below 20%.