How to use the sensor below the mbot


#1

Does anyone know how to use the sensor that looks below the robot? The one that it uses to follow along the black line? I notice that when I roll the mbot to the edge of the table, blue lights turn off so it seems like I could right a program to make him explore the table but not fall off the edge.

thanks
Selwyn


#2

Ah, I finally found it. It is called the line follower. It seems to return a value of 0, 1, 2 or 3. Digging deeper.


#3

Yea, the values are for each sensor. if you have a handle on binary you can easily separate the values but for the simple answer you can expect 0 if neither sensor sees a reflection of their own emitter (black or not on the ground) Sensor 1 will add a 1 to the output and Sensor 2 will add a 2 to the output of they see their reflection (white background) so getting both will result in a 3 value since you would add the 1 and the 2.
see the source here for the more technical info:
https://github.com/Makeblock-official/mBot/blob/master/mBot-default-program/MeLineFollower.h


#4

Thanks for the link to the source - that does make a lot of sense. Any details on the light sensor? I don’t see anything obvious in the source. When I turn it on, I get a value of ~300 in light and ~500 in dark. Does that seem right?

Selwyn


#5

use the wiki, it is a goldmine :smile:
http://wiki.makeblock.cc/index.php?title=Me-Line_Finder


#6

I second that! FYI here is the light sensor page.
http://wiki.makeblock.cc/index.php?title=Me-Light_Sensor


#7