Dear OLHOC staff, thanks for the oppertunity to run the two workshops today.
I hope you enjoyed them as much as I did.
I have purchased a copy of an eBook A_Gentle_Introduction_to_Robotics for the OLHOC library.
The example programs from this book are avaiable online at:
https://github.com/senestone/A_Gentle_Introduction_To_Robotics_With_mBlock_and_mBot
The mBot is programmed via a USB cable please make sure that students plug the US cable into the USB port on the mBot and NOT the one of the motor ports this is a common mistake.
Your first mBlock program blink some lights
First make sure that the mBlock program is set to the mBot (mCore) board. Select Boards > mBot (mCore)
Connect the Mac to the serial port. It's the port with a number on it.
It should be the bottom port on the list.
Start with the mBot Program block,this is located in the Robots set of block
Switch back to the control clocks and drag out a repeat block
Note 255 is Maximum brightness, you can use a smaller value if you don't want the LED to be as bright.
Switch back to the control blocks and add a wait block and change the delay to 0.5 seconds
Continue as follows:
Once you have completed your program upload it to the mBot.
1) Connect the USB cable to the USB port, not the Motor port.
2) Turn on the mBot
3) Select the Serial Port choose the option with a number.
4) Click on the mBot program block to open the Arduino code window.
5) Click Upload to Arduino
The code will take around 30 seconds to compile and upload.
6) Once the code has finished uploading you will see "Upload Finished"
7) To run the program you have to press the on board button
Moving Forward
There is a good chance that the mBot will not run in an exctly straight line, this is becasue of differences in the friction within each gearbox.
One way to compensate for this is to drive one motor faster than the other.
The Wait until < on board button pressed > is important. This prevents the program from executing before the mBot is disconnected from the USB cable.It allows students to position the robot on the floor before the program "runs"
For more ideas see code examples at:
https://github.com/senestone/A_Gentle_Introduction_To_Robotics_With_mBlock_and_mBot