Step 1: Initial Setup
1. Get a mBot with Bluetooth module from Makeblock, follow the user manual and assemble your mBot.
2. Follow the instruction on https://github.com/Makeblock-official/mbot_nodebots and install dependencies.
3. Install socket.io and express with commands npm install email@example.com and npm install firstname.lastname@example.org.
Step 2: Program the MBot
You can download the attached file to see all codes. Please make sure the sonar sensor is plugged into port 2.
Step 3: Create a Web Interface
In this section, bootstrap-slider and CreateJS are used to set up the web interface. You can find their detailed information in the following websites:
Different sounds will be played depending on the distance between sonar sensor and obstacle, and then the red ball will move accordingly. Motor speed and distance are displayed on the web interface.
You can download the attached file to see all codes. Unzip the file, copy the pubic file and paste it into your project file.
Step 4: Test and Have Fun
1. Pair your laptop with Bluetooth module on the mBot, you can follow the instruction on https://github.com/Makeblock-official/mbot_nodebots (see Bluetooth module section).
2. Turn on mBot, run the move.js with the command node move.
3. Open your browser(Chrome suggested), input localhost:3000 in the address bar and press enter.
4. Use up, down, left, right and space keys on your keyboard to control the mBot. We are ready to play musical mBot, change motor speed and interact with ball on the web interface.