mBlock 5 Example Projects
Example: Control mBot Through Bluetooth Controller
Through programming, we can enable Bluetooth Controller to perform the following functions:
Use the joystick to move mBot
Move the right joystick: mBot moves in the same direction as the joystick and its moving speed depends on how far the joystick is pushed.
Use the buttons to move mBot
- Press the D-pad ↑:Moves forward at power 100%
- Press the D-pad ↓:Moves backward at power 100%
- Press the D-pad ←:Turns left at power 100%
- Press the D-pad →:Turns right at power 100%
Use the buttons to make mBot turn around
- Press button L1: Spins from right to left
- Press button R1: Spins from left to right
Use the buttons to control the color of LEDs
- Press number button 1:All LEDs on in red
- Press number button 2:All LEDs on in green
- Press number button 3:All LEDs off
- Press number button 4:All LEDs on in blue
- Press multipke number buttons: All LEDs on in mixed color
Use the buttons to control the buzzer
- Press button L2: Play note D5 at 0.25 beats
- Press button R2: Play note A3 at 0.5 beats
For the specific code, download the example project and open it on mBlock 5.
Example: Control mBot Ranger Through Bluetooth Controller
Through programming, we can enable Bluetooth Controller to perform the following functions:
Use the joystick to move mBot Ranger
Move the right joystick: mBot Ranger moves in the same direction as the joystick and its moving speed depends on how far the joystick is pushed.
Use the buttons to move mBot Ranger
- Press the D-pad ↑:Moves forward at power 100%
- Press the D-pad ↓:Moves backward at power 100%
- Press the D-pad ←:Turns left at power 100%
- Press the D-pad →:Turns right at power 100%
Use the buttons to make mBot Ranger turn around
- Press button L1: Spins from right to left
- Press button R1: Spins from left to right
Use the buttons to control the color of LEDs
- Press number button 1:All LEDs on in red
- Press number button 2:All LEDs on in green
- Press number button 3:All LEDs off
- Press number button 4:All LEDs on in blue
- Press multipke number buttons: All LEDs on in mixed color
Use the buttons to control the buzzer
- Press button L2: Play note D5 at 0.25 beats
- Press button R2: Play note A3 at 0.5 beats
For the specific code, download the example project and open it on mBlock 5.
Example: Control Codey Rocky Through Bluetooth Controller
Through programming, we can enable Bluetooth Controller to perform the following functions:
Use the left joystick to move Codey Rocky
Move the left joystick: Codey Rocky moves in the same direction as the joystick and its moving speed depends on how far the joystick is pushed.
Use the right joystick to control Codey Rocky's eyes
- Move the right joystick upward: Emotion–Looks up
- Move the right joystick downward: Emotion–Looks down
- Move the right joystick left: Emotion–Looks left
- Move the right joystick right: Emotion–Looks right
Use the buttons to move Codey Rocky
- Press the D-pad ↑:Moves forward
- Press the D-pad ↓:Moves backward
- Press the D-pad ←:Turns left
- Press the D-pad →:Turns right
Use the buttons to make Codey Rocky turn around
- Press button L1: Spins from right to left
- Press button R1: Spins from left to right
Use the buttons to control Codey Rocky's emotion
- Press number button 1: Emotion–Naughty
- Press number button 2: Emotion–Hello
- Press number button 3: Emotion–Wow
- Press number button 4: Emotion–Yummy
Use the buttons to make Codey Rocky a judge
- Press button L2: Emotion–Yes
- Press button R2: Emotion–No
For the specific code, download the example project and open it on mBlock 5.
Example: Control a Sprite Through Bluetooth Controller
Through programming, we can enable Bluetooth Controller to perform the following functions:
Game Start
Click the green flag under the stage and press button "+" on Bluetooth Controller.
Use the left joystick to move the sprite
Move the left joystick: The sprite moves in the same direction as the joystick and its moving speed depends on how far the joystick is pushed.
Use the buttons to move the sprite
- Press the D-pad ↑:Moves forward
- Press the D-pad ↓:Moves backward
- Press the D-pad ←:Turns left
- Press the D-pad →:Turns right
Use the buttons to control shooting
- Press number button 1: Shoots
- Press number button 2: Shoots
- Press number button 3: Shoots
- Press number button 4: Shoots
For the specific code, download the example project and open it on mBlock 5.