HomePage/assetList/Buggy Program Tutorial: Offline Mode
Buggy Program Tutorial: Offline Mode
3480 0
Production process

Start using the mDesigner 3 (Offline Mode):

Hi, everyone! This is the tutorial to show you how to do programming in mDesigner3!
For more reference about the user interface and the introduction of Scratch 3. Please visit:
https://idealab.microduino.cc/asset/5bc78ffc92419000117004a8

In mDesigner 3, there are two different modes: online and offline. The mode can be changed on the top right corner.
For Offline Mode, mDesigner 3 can transfer the Scratch graphical code to an Arduino IDE code and upload the code into the Buggy for offline performing.
Be careful! You only can upload the program to Buggy with a "USB-to-MicroUSB" cable plugged into the Buggy battery.
After the program is uploaded to the Buggy, you can unplug the "USB-to-MicroUSB" cable. Buggy will remember the commands and start performing the commands when it is turned on.

To use the Buggy code block for Buggy programming, first select "IBB" which is located in the middle bar to access the Buggy code blocks on the left hand side.


Setup for Uploading Programs to the Buggy

To access the controls of Buggy by uploading program, it is important to make the connection between PC and the Buggy first.
Step 1: Plug in the "USB-to-MicroUSB" cable to "mCenter+" and turn on the battery.

Step 2: Select the "Serial Port" option, located in the middle top bar's drop down menu below "disconnected".
For Mac, it will be showing /dev/tty.SLAB_USBtoUART
For Windows, it will be showing COM7 (numbers behind COM might vary)

Step 3: After selecting the "Serial Port", mDesigner 3 will remember the device, and the middle bar will change to "Connected".

Step 4: Now, press "Flash firmware" to upload a empty code to the Buggy. An "Uploading project" window will pop-up, and it will say "Done" at the end. Congrauation! You have already accessed the Buggy controls in offline mode.

Last: After uploading the program to Buggy, the middle bar will change back to "disconnected"; however, you don't need to select your Serial Port again since mDesigner has already remembered your device, and the Serial Port option should be changed to a light blue color.


How to control the Buggy with different code blocks?

A Hat block is needed to drop down from Events first. Hat blocks are the blocks that start every script. They are shaped with a rounded top and a bump at the bottom.
This is the "start" of the program, and it is very important to drag this block down first for every program.
For the next step, a C block (called "forever") will be simply added under "start". C blocks is also known as "Wrap blocks", these blocks loop the content within the C's or check if the condition is true.
The "forever" C block means it will repeat the contents inside forever.
The "start" Hat block and "forever" C block is usually a basic beginning to the program.

Compare to the Arduino code on the right side, there are two major parts for the code: void setup() and void loop().

The commands outside the "forever" C block will be stored into the void setup(), and those commands will be runned for one-time only.

If the commands are inside the "forever" C blcok, they will be stored inside the void loop(). Those commands will be repeated infinitely.

Example: Move Buggy forward for 3 seconds

From previous, a "moving forward" Stack block is added inside and outside the "forever" C block to show the difference, so what is Stack blocks?
Stack blocks are shaped with a notch at the top and a bump on the bottom. They can perform the main commands for the program. The "moving forward" Stack block can control the moving direction, speed and duration time for the Buggy.
In the Arduino code, there are 3 numbers inside the parentheses. The first number is to control the direction as 1 is moving forward and -1 is moving backward. The second number is the speed rate, and the range is from 0 to 255. The third number is the Buggy running time. (BuggyCarTime is a built in function for Buggy to move in a duration time.)

After finishing the coding, press "Flash firmware" on the top right corner to upload the program into the Buggy.
Now, the command has already stored into the "mCenter+". You can turn off the Buggy battery and unplug the "USB-to-MicroUSB" cable. Place the Buggy on the table and turn it back on. The Buggy will automatically run the command inside and move forward!

However, you might wonder why Buggy doesn't stop after the 3 seconds duration time. Do you know the reason?
It is because the stack block is inside the "forever" loop!
According to the description of "forever" C block, it will repeat the contents inside forever. Therefore, after 3 seconds of running duration, the program will do the same thing again, and your Buggy will move for another 3 seconds!
Therefore, another Stack block is needed for this command. The "delay"stack block from Control.
This small block can temporarily stop the program for couple seconds.
Let's drag this below the "Buggy moving" Stack block and reupload the program to the Buggy!

After uploading the program, the Buggy now should move forward for 3 seconds, then stop for 1 second, and then repeat this content again.

Open an file

If you have an exsiting file or the previous project, you can follow the instruction below to open the old project!
Press the file icon on the top left corner to open and load the .md3 file.
Choose the project you want and click open:
Now, you can see the previous project you saved!

This is the end of the online mode tutorial. Thank you so much for reading!
Don't forget to sign up on our IdeaxCollege to become. The ideaLab will also upload more tutorials and interesting projects in the future. Microduino is also waiting for you to share your creative Buggy inventions on our IdeaLab!
If you have any questions, you can contact us under the Q&A webpage. Our technical support will reach out to you and help to solve any issues you have.
Required hardware
data
Code show
data
Attachment download
data
0
Master, don't look at it silently. Please login to help me comment.

Register now