An earlier blog post (mbots - graphical programming and Arduino) discuss some of the basics of the robot. Just for fun I wanted to play with the ultrasonic sensor, getting the robot to react, change direction (run away) and the 'face' on an LED matrix that came with the robot if there is an object in the way.
The routine
- Loop
- Show a smiley face (using Port 4 )
- If the ultrasonic detector senses something close (guessed at a setting of 10)
- Go backwards quickly
- Play a tone
- Show an upside-down smiley face
- wait 1 sec
- Otherwise
- Move forward
- End the loop
Download the code to the mBot using the Upload to Arduino button (see below). Here is where you find out whether you have set the system up correctly. In the mBlock editor pull down menu choose Connect and select the required connection; I have been using a USB cable so I needed to select the serial option and select the USB hub. After that using the Upload to Arduino button did lead to the code downloading.
The video below shows it in action
This is good fun, and a very cute. The build quality of the bots (not my building ability) the metallic construction means the bots feel substantial. The software as it is Scratch based I think it will be interesting to try it out with my Code Clubbers - especially as they have been asking to play with more robots.
As always I would be interested to hear from others on their experiences of using this little robot.
Related links
mbots - graphical programming and Arduino
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.