Book Image

Smart Robotics with LEGO MINDSTORMS Robot Inventor

By : Aaron Maurer
Book Image

Smart Robotics with LEGO MINDSTORMS Robot Inventor

By: Aaron Maurer

Overview of this book

LEGO MINDSTORMS Robot Inventor is the latest addition to the LEGO MINDSTORMS theme. It features unique designs that you can use to build robots, and also enable you to perform activities using the robot inventor application. You'll begin by exploring the history of LEGO MINDSTORMS, and then delve into various elements of the Inventor kit. Moving on, you'll start working on different projects which will prepare you to build a variety of smart robots. The first robotic project involves designing a claw to grab objects, and helps you to explore how a smart robot is used in everyday life and in industry. The second project revolves around building a working guitar that can be played and modified to meet the needs of the user. As you advance, you'll explore the concept of biomimicry as you discover how to build a scorpion robot. In addition to this, you'll also work on a classic robotic challenge by building a sumobot. Throughout the book, you'll come across a variety of projects that will provide you with hands-on experience in building creative robots, such as building a Dragster, Egg Decorator, and Plankton from Spongebob Squarepants. By the end of this LEGO book, you'll have got to grips with the concepts behind building a robot, and also found creative ways to integrate them using the application based on your creative insights and ideas.
Table of Contents (12 chapters)

Writing the code

You have this wonderful Plankton build and it is only cool if it indeed moves and interacts with the environment. This code will walk you through some ways to bring Plankton to life, while providing enough openness to be tweaked to your liking.

The code for this project is designed to achieve the following objectives:

  • Use two motors to create arm movement.
  • Use one motor to enable the head to turn.
  • Use one motor to open and close the mouth.
  • Use a color sensor to code voice or movements.
  • Use a distance sensor to trigger responses.

The ports

Before you dive into the code, let’s be sure that your motors and sensors are properly plugged into the proper ports. The neck motor, which will allow Plankton to move to the left and right, should be in port A. The motor that opens and closes the mouth needs to be in port C. The arms will be in ports D and E. The color sensor on the front of Plankton will be plugged into port F. Later,...