Fantastic Robot with Memory

Fantastic Robot with Memory

por Citilab Edutec

Boards
Placas:

Citilab ED1

Component/s
Componentes:

Ninguno
This activity is part of the Citilab Course. Check it out!

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.

List blocks

List Inputs

Item from a list

Saving and deleting commands

  • The block add _ to list _ allows you to add items to a list, on the other hand with the block remove item _ from list _ you can remove one 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 remove-items block with the all option selected.

  • Each movement button will save an identifier of the corresponding order. The 500 milliseconds wait prevents many commands from being added when a button is pressed.

Initialize Command list

Delete Commands

Add Command

Selecting and executing commands

  • In the commands list we have the sequence of movements that we want the robot to execute.

Variable with list of commands

  • To access a command, use the block item _ of list _.

Access an item

  • The control block for i in _ allows iterating through the list. The value of i corresponds to each of the saved items or commands.

Add command

  • 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.

Challenge

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.

ED1 Child Robot Program

ED1 Child Robot

CC-BY-SA

© por Citilab Edutec 2019-2022.
Este trabajo tiene una licencia CC-BY-SA 4.0.