Fantastic Robot with Memory
Lists
To make the robot able to reproduce a few commands in a row, it is necessary to save them beforehand.
We have already used variables to store numbers or texts. In this case we will use one to store a list of commands.
Lists allow us to save a set of data that we can access individually.
The Data category blocks are used to manipulate the lists.


 

Saving and deleting commands
The block
add _ to list _allows you to add items to a list, on the other hand with the blockdelete item _ of list _you can delete one, the last or all the items from the list .Our robot will have to empty the command list when starting or when we press the X button. This can be done by saving an empty list to the variable, or using the
delete item _ of list _block with the all option selected.
 
 
- Each movement button will save an identifier of the corresponding order. The 
wait 500 millisecsblock prevents many commands from being added when a button is pressed. 
 
Selecting and executing commands
- In the commands list we have the sequence of movements that we want the robot to execute. For example:
 
 
 
- To access a command, use the block 
item _ of _. 
 
- The control block 
for i in _allows iterating through the list. The value of i corresponds to each of the saved items or commands. 
 
- All that remains is to move the engines based on the commands in the list with the OK button.
 
Challenge 1: Program the robot with memory.

Solution to challenge 1
 
Child ED1 robot
The program used in schools with the Fantastic robot adds sounds and images to the screen to improve interactivity.
You can download it from here.
 
| ⬅️ Previous activity | Next activity ➡️ | 
|---|
					© por Citilab Edutec 2019-2025.
					Este trabajo tiene una licencia CC-BY-SA 4.0.
				
