Experiments 3.Line Following when Avoiding Obstacle

Share for us

Under the RollFlash there is a 5-channel line following module, which enables the robot to go following a black line. In addition, in the sketch 4. Following, the part for obstacle avoiding is also included. Therefore, after the sketch is run, the RollFlash can smartly avoid the obstacle ahead when following a line. Let’s check how to make it!

1. Open Following.ino under Rollflash Bionic Robot Turtle for Arduino/Code/ 4. Following and upload it to the robot.

2. DIY a mapPrepare a white board (or a flat light-color surface) and some black tape or a black Marker (not permanent). Then draw some straight-line or curved shapes with the pen or sticking the tape. Or, you can also do on a black surface like blackboard with a white chalk. But, DO pay attention to the following TIPS:

a) The lines should be at least 16mm wide.

b) The semi-diameter of the curve should be no less than 100mm.

c) Within 40mm on both sides of the line, there should NOT be anything almost black (especially dark purple); otherwise, the IR sensor will be influenced when detecting.

d) The edge of the STOP block should be perpendicular to the trunk; the block should be 50mm wide and 60mm long at least.

  1. You can place some obstacles on the line to see the RollFlash bypass them when following the line.

It’s quite fun to draw the lines and figures aside. Just keep the tips in mind when playing. 


The code file Dance.ino under Rollflash\Rollflash Bionic Robot Turtle for Arduino\Code\5. Dance\Dance, as the name suggests, is to make the RollFlash dance. Upload the code to the board and the robot will just dance. That’s quite cute and lovely, just like a baby!

Note: To learn more about the code in these experiments, you can find details in the following chapter, Code Explanation.