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