How to Write Code and Upload It in Mblock
Typically, students use mBot mBot and STEM Activities Module (MBOT-B) or mBot and STEM Activities Module (MBOT-P), Codey Rocky and Activities Module (MB-CR), or mBot™ Ranger (MB-RANGER) with its Default Program or in "Upload" mode, in which code is uploaded to mBot and run without a connection to mBlock. Coding with mBot: Self-Driving Vehicles (MBOT-MSDV-E), Coding with Codey Rocky: Mission to Mars (MBCR-M2M-E), and the activities for mBot STEM Classroom Kit (MBOT-SKIT) are all written with the expectation that students are programming their robots in Upload mode.
What is Live Mode?
Live mode is a unique programming mode in mBlock 5 that you can use to both Stage in the mBlock window and the robot at the same time. Here's additional details:
- In this programming mode, mBlock is connected to mBot via USB cable or wirelessly using the Makeblock® Bluetooth® Dongle (MB-BLE).
- You program the robot through the mBlock 5 software. You can create code for both Sprites and your robot; when the program is run, action will happen both on the mBlock Stage on screen and with your robot.
- Programs you would like the mBot to execute should start with the "When green flag clicked" hat block, "When [key] pressed" hat block, or similar hat blocks found in the Events palette.
Advantages of Live Mode
Creating and troubleshooting code is fast in Live mode because you do not need to take the extra step of uploading your programs to your robot before running them. Additionally, Live mode allows for unique programs that utilize both the mBlock Stage and the robot's hardware. For instance, you can program mBot to move when sprites on the Stage are clicked. Or a sprite can report the value that the mBot light sensor is reading.
Disadvantages of Live Mode
For some types of programs, especially those requiring the robot to act on or respond to data from its ultrasonic and line-following sensors, Upload mode is best because the code runs quickly; the robot will respond much sooner to changes. In Live mode, mBlock sends commands sends one by one to the robot, the robot performs each command as it arrives, and then reports back to mBlock. This process is generally too slow for line-following activities, especially if the robot is driving quickly or the line-following route changes a lot.
Switching mBot to Live Mode
The robot firmware needs to be reset to the Default Program before you can use Live Mode. Complete the following steps:
- Power on mBot and connect it to your computer via USB cable.
- Open the mBlock 5 software.
- If mBot does not already show in the "Devices" pane, use the "+" button to add it.
- Connect the software to mBot by clicking the Connect button. The mBlock 5 software will identify the USB port to which mBot is connected.
- Once connected, click the Setting button and select "Update Firmware".
- From the Firmware Version drop-down menu, choose "Factory Firmware(06.01.009)".
- Click the "Updates" button.
- mBlock will now upload the Default Program. When it is done uploading, mBot will give three beeps.
- Move the slider switch, if necessary, to Live mode.
mBot Troubleshooting and FAQs
How to Write Code and Upload It in Mblock
Source: https://www.vernier.com/til/4141
0 Response to "How to Write Code and Upload It in Mblock"
ارسال یک نظر