mBot Arduino Programming Guide (I/O)


Hi all,

Link to Quick Reference (Google Doc - comments enabled and welcome)

I am creating this quick reference for a short workshop I teach. It is very brief but maybe helpful to kick start programming in mBot. Makeblock documentations are not very friendly to programmers who want to do proper Arduino programming. The Makeblock

It contains code samples to interface with each input and output. Except the IR Transmission. (Would love to figure out that part too, the IR LED should be able to send serial information. With multiple bots, can do swamp behavior over an IR network)


  • RGB Led (On board)
  • DC Motors (Left and right wheel)
  • Buzzer


  • Black Line Finder Sensor
  • Light Intensity Sensor
  • Ultrasonic Distance Sensor
  • Button (On board)
  • Infrared Sensor from IR Remote

chuckmcknight mentioned about writing a book. Looking forward to that.

How can I program MBot using Arduino ide instead of MBlock
Getting started with Arduino C coding with mBot Ranger

Very clear. Well done. I look forward to seeing more of your documentation.


Thanks for the quick reference, it is very helpful. I am creating a community college class with the mBot, and this has helped speed up my development of the Arduino programming part. I am also looking forward to Chuck’s book on Arduino programming for the mBot. I bought his book, A Gentle Introduction to Robotics,it was excellent!