Accordingto the instructions to complete the assembly, pay attention to the wiring ofeach modules, port 2 should be connected to the Me line follower module, port 3should be connected to the ultrasonic sensor and LED matrix should be connectedto port 4.
mBlockis a graphical programming environment based on Scratch 2.0, you can finishprogramming via drag and drop different graphical blocks, it is a good choicefor beginners to learn how to program.
2.1First create a variable, click the "Make a Variable" of "Data&Blocks",create a variable named "num" as shown below, this variable will be used in thefollowing part.
2.2Set two operating modes of the ultrasonic module on LED matrix, first isdirectly display the distance data that the ultrasonic detected, another modeis according to the different distances to show different expressions, thesetwo modes will be switched via the buttons on the IR remote controller.
mBlockhas a very convenient face panel, click the red circle part will popup thisface panel.
2.3Set the different buttons of IR remote control to display differentexpressions.
Thefinal mBlock programs please click here.
Firstuse USB cable to connect mBot and computer, choose the appropriate serial port,select mBot board, and install firmware.
Afterfinish installing firmware, disconnect the serial port, switch to bluetooth or2.4G wireless connection mode, then click program you can start testing.
Accordingto the different buttons of IR remote controller, it can switch to differentexpressions.
4.Advance,use Arduino IDE to program
mBlockcan output Arduino codes, if you are more accustomed to write programs inArduino IDE, you can build the program frame blocks first and then output theArduino codes, make some changes, this is a easier way. First replace thebeginning part of program as "mBot Program", then switch to Arduino mode,choose "Edit with Arduino IDE", and you can write programs in Arduino IDE.
InArduino codes, use for loop to change the LED luminance and achieve the blinkeffect as shown below.
TheArduino programs please click here.
UploadArduino codes into mBot, you can start to play with it.