Mbot2 | Line Follower Code !free!

This sensor is mounted on the front underbelly of the robot. It contains four Light-Emitting Diodes (LEDs) and four Light Sensors arranged in a linear array.

# Sensor channels (0 = leftmost, 4 = rightmost) self.NUM_SENSORS = 5 mbot2 line follower code

// Apply correction to motors int leftSpeed = baseSpeed - correction; int rightSpeed = baseSpeed + correction; This sensor is mounted on the front underbelly of the robot

# Get sensor states (0 = black line detected, 1 = white surface) left_on_line = bot.linefollower_left_state() == LINEFOLLOWER_STATE_BLACK right_on_line int rightSpeed = baseSpeed + correction

Scroll to Top