Communication ECA Phase IV Class 7: Roaming Vehicles 20181024

This lesson will focus on arrays and how they can be used to control the actions of the students’ wheeled robots. Students will discover what arrays are, how they work, and why they are important in computer programming. They will also learn how to incorporate an array into their program.

The students are going to program their robot to move according to a recorded set of instructions given to it through the buttons on the EV3 Brick according to these parameters:

Program 1: Recording One Action to Make the Robot Move

  1. Start the program.
  2. Create a Variable Block called “Drive”.
  3. Wait for a Brick Button to be bumped.
  4. Play sound “Click 2”.
  5. Record the numerical value of the pressed button in the variable “Drive”.
  6. Wait for 2 seconds.
  7. Play sound “G02”.
  8. Read the number stored in variable “Drive” and send the value to a switch.
  9. Numeric switch:
  10. If Drive = 1, curve turn the robot left.
  11. If Drive = 3, curve turn the robot right.
  12. If Drive = 4, move the robot straight forward for 2 rotations of the wheels.
  13. If Drive = 5, move the robot straight backward for 2 rotations of the wheels.
  14. Play sound “Game Over 2”.

Program 2: Recording Several Actions to Make the Robot Move (Optional)

The students will use the “array operations” and “Variable” blocks to realize a function to first recording several actions and then drive the robot.

In an Array Operations Block, record the button press in the Value parameter, loop number in the Index parameter and variable name in the Array parameter. Write all the information from the Array Operations Block into the “drive” Variable Block.

Play2Learn Education