top of page

Lego Robot!

This week, we continued on with our use of coding and coding apps for iPad. We utilized the app, LEGO Mindstorms to program a LEGO robot to lower its arm over a block of "toxic waste", move the move the toxic waste, raise its arm again, back away from the toxic waste, turn around, and run away to hide behind what ever we decided to make from the LEGO Quest website (I made an alien).

 

Additional Program and Video

For the additional programming task, we were asked to program the LEGO robot to go forward until its touch sensor hits a wall, back up, turn around, and then drive in the opposite direction

Here is my video of the robot crashing and then rolling away

This is the program used for the Lego crash. For this additional task, I set the robot to move straight forward until the touch sensor hit a wall (this can be seen in the first two boxes of the program code). The robot then backs up (box three of the code-- this explains the negative value in the power variable), and turns around (this is done by setting the wheels of the robot to opposite values and by setting the robot to turn for enough time for it to face away from the wall). Finally, the robot runs away from the scene of the crash for five seconds at maximum speed (seen in the final box of the program). The variables within this program also have a significant effect on how the program runs. The contents of box four of the program is what makes the robot turn around. The wheels of the robot need to move in opposite directions so that the robot turns instead of going straight. In box five of the program, the timer is set to just long enough for the robot to rotate around so that it can drive away. If the timer was set for too long or too short a time, the robot could end up hitting the wall again instead of the opposite direction of the wall. 

LEGO Robot Program
Materials used for this Project

[Click below on my LEGO alien to view the LEGO Quest website]

This program begins with the robot driving forward until it is within 4 cm of the LEGO block (our block of "toxic waste"). This section of the program can be seen in the first two boxes of the program. After the robot reaches the toxic waste, it drops its arm over the block and pushes the block forward (which can be seen in the fourth and fifth boxes). Then, the robot lifts its arm (box six) and slowly back away from the toxic waste (box seven). The robot then turns around and drives towards the LEGO alien, and turns once more to hide from the toxic waste behind the alien (boxes eight through eleven). Although this program appears to be relatively simple, the variables within each section of the program have a huge impact on how the program runs. For example, the sensor that "sees" the toxic waste block needs to be set to where the robot is close enough to the block when the sensor tells the robot to stop (block two). If the robot is too far away when the sensor tells the robot to stop moving, the arm will miss the block, and if the robot doesn't stop soon enough, it will just push the block out of the way instead of trapping it under the arm. Also, when the robot's arm is lowered over the block of toxic waste, the program is set to a negative value, and when the arm is raised again, the value needs to be positive. The adjustable variables are what makes a program like this one run smoothly. 

Here is the video of my LEGO robot in action! 

© 2017 by Kaeta Seimer (Build It) Created for Educational purposes. Proudly created with Wix.com

  • Facebook Social Icon
  • Twitter Social Icon
  • Google+ Social Icon
bottom of page