Steps to Successfully Upload “mBlock” Code to Your Robot
Instructional Video: Mobile or You Tube
Steps To Follow:
- Open the “mBlock” program.
- Select MM/Edit/Arduino Mode (Arduino Mode will allow you to send code from your computer to your robot.).
- Either Load a program (MM/File/Load Project) you have previously written, or create a New program (MM/File/New).
- Select the correct processing board that will be processing your code. We are using mBot(mCore): MM/Board/ mBot(mCore).
- !Save everything you have done so far!
- Connect robot to the computer with a usb2 cable.
- Now open a port that will allow the computer and robot to communicate:
- MM/Connect/Serial Port/ dev/tty.usbserial-1420. (The port you select is last in the list and will always begin with "tty.usbserial... The number will not be the same as the one shown here (1420).
- Note:The grey title bar will say either “Disconnected” or “Serial Port Connected.” You may have to redo this step at least 4 times before a connection is made. If a connection is not made after 4 attempts, quit MBlock, disconnect the cable, turn off the robot and start all over.
- Double Click “mBot Program” (the first block in your code), so that your program is highlighted in gold.
- Turn on your Robot!
- Problem: For the chipset to accept the new program, the robot must be on…which means it will play the old program until the point that it begins to receive the new program. Pick up and hold the robot, becuase the wheels are most likely going to begin spinning the moment you turn on the robot.
- Click “Upload To Arduino” which is at the top of the Arduino screen.
- If the upload is successful, it will say, “Upload Finish.”
- If not successful, it will usually either stall and nothing happens or say “Failed.” If so, try to upload at least two more times. You will have to reestablish a port once again. Follow the same steps you followed above. If after 3 tries it does not work, disconnect the cable, quit the mBlock program, open it again and start all over from the beginning.
Note: Disconnect the USB cable when testing your robot/program. Your program will ‘Loop’ if the USB remains connected.