Robot Instructions

Materials:

Safety:

Instructions:

PART 1: LINE FOLLOWER

  1. Familiarize yourself with the various components of the robot and follow along with the introduction to the robot components, including where the reset button is located and how to connect the robot to the laptop.  
  2. Create your own path for the robot to follow with the tape and paper provided.
  3. Connect the MCore board to the laptop and open the “LineFollower” sketch.
  4. Confirm that the laptop “sees” the Arduino board by checking TOOLS/PORT and confirming that one of the COM ports is recognized.
  5. Upload the LineFollower sketch to the MCore board by clicking on the Right Arrow symbol in the Arduino interface development environment (IDE).  If the program verifies and uploads properly, there will be a message in white at the bottom of the screen.
  6. Unplug the robot and place it on the path created in step 2. There is a reset button on the robot to restart the program.

PART 2: MOVEMENT

  1. Now, reconnect the MCore board to the laptop and open the “Movement” sketch. REMINDER: Upload the “Movement” sketch to the MCore board by clicking on the Right Arrow symbol in the Arduino IDE.
  2. Look at the program and study the commands in the “void setup()”.  Hold the robot and compare the wheel motions with the commands in the sketch.
  3. Try to modify the commands to make the robot do other things.  Every time you modify the code, you will need to re-verify and upload the code to change the robot actions.  REMEMBER: Once your sketch has been uploaded to the robot’s brain, you can set her free by unplugging the computer and clicking the reset button when you are ready to try the course!
  4. Continue to modify your sketch using the commands available and “tune” your code to get the robot to navigate the challenge course.

PART 3: ULTRASONIC SENSOR

  1. Finally, open and upload the “Sensor” sketch to the MCore board by clicking on the Right Arrow symbol in the Arduino IDE.
  2. Open the serial monitor in TOOLS/SERIAL MONITOR (or Ctrl+Shift+M).  Put your hand in front of the ultrasonic sensor and confirm that it is measuring distances properly.
  3. Look at the program and study the commands in the “void loop()”.  Hold the robot and compare the wheel motions with the commands in the sketch.  What would you believe should happen when the ultrasonic sensor sees an obstruction?
  4. Using the commands you learned from “Movement”, find a way to have the robot navigate the course using the sensor.

How your robot’s “sketch” brain works

To program the “brain” of your robot, you need to modify the program, or “sketch”, which is then uploaded to the mCore board.  Everything within the “void setup()” statement (between the pair of curly brackets { }) will only run once to determine what the robot does. Everything within the “void loop()” statement (between the pair of curly brackets { }) will loop over and over and determine what the robot does.

The robot can execute commands sequentially. To have the robot make decisions based on conditions, use the IF/ELSE command. If the statement in the parentheses after the IF is true, it will execute what is between the next curly brackets.  If the statement is false, it will execute what is after the ELSE statement.  Note that you can also write a simple IF statement with no ELSE, and you can embed these decision statements within each other!

If you want to change how far the robot turns right or left, or rotates right or left, place a longer delay in between commands, or increase/decrease the speed.

Here are some of the commands you can use to get your robot to move through the challenge course:

Commands

move(1,250);

move(2,30);

_delay(3);

move(3,80);

move(4,100);

Debugging

If you modify your code but it doesn’t properly upload to the Arduino board, you’ll have to figure out why.  Check that you spelled your new commands properly and that you ended the line with a semicolon “;”.  You may have to re-check that the board is still properly recognized by one of the computers COM ports, which we showed you in the introduction (TOOLS/PORT).

Engineering Tomorrow09/28/2017