MBC Pathfinder 8-Way (Line8) × EV3 clev3r

Read the Pathfinder with clev3r in three steps

A clev3r (EV3 BASIC) program goes in this order. First create the project and pick the port. Then set the sensor mode. Last, read values and show them on the EV3 screen. Follow the steps on the left, and the program on the right grows with you. Drag the black line under the sensor simulator to see what the EV3 screen shows.

1

Create the project, pick the port

clev3r needs no extension and no files to import. On the EV3, the sensor pretends to be the LEGO infrared sensor (type 33), so you read it with the normal Sensor commands. The first line, folder, sets the folder the program goes into on the EV3.

  1. Install clev3r (we tested version v1.7.1.0).
  2. Turn on the EV3 first. Then plug the sensor into the port you pick below.
  3. Make a new program and write the lines below.
  4. Press "Compile and download". On the EV3, open the file menu and run it from the folder that starts with MBC_.
Which port is the sensor on?

The first number in the program (for example Sensor.SetMode(1, 0)) is the port. 1~4 are the EV3 ports 1~4.

2

Set the mode

The sensor has several "modes". Each mode sends back a few numbers at once. Sensor.SetMode(port, mode) picks one. Use only one mode in a program: the EV3 needs about 1.1 s every time it changes mode.

Pick a mode (if you pick a reading from another mode in step 3, this changes too):

3

Read and show on the screen

Sensor.ReadRawValue(port, which one) takes one number from the current mode (counting starts at 0). LCD.Text writes it on the EV3 screen. The EV3 screen can only show English letters and numbers, so the labels are short English words. Click a reading, and the program and screen change to its example.

Sensor simulator (looking from behind the robot): drag the black line and watch the output on the right

The simulator is only a picture. The maths is simpler than the real thing, so a real sensor may be off by a channel or two. Light value 0 = black, 100 = white. A red ring = that channel sees the line (light value below 50).

An example for every reading

Full examples


        

!


        

!


        

!

Good to know

  1. The EV3 edition cannot take commands from the hub (E0~E9 cannot be sent on the stock firmware, Pybricks or ev3dev). Hold the board button while powering up = white-line mode (not pressed = black line); press the calibration button while running = 5-second dynamic calibration. Left/right swap and thresholds are not available on the EV3 edition; use the SPIKE or I2C edition for those. Pybricks InfraredSensor.buttons() does not work (mode 2 is line position and raises OSError 5); use the MBC library or LUMPDevice.
  2. Use only one mode in a program. The EV3 waits about 1.1 s every time it changes mode. Mode 2 is the most used for line following: fine position [0], line width [1], far left [2] and far right [3] all come together.
  3. Unplugged = 0. In clev3r, Sensor.ReadRawValue gives 0 when there is no data, and the program keeps running. To check the cable, use Sensor.GetType from the "Is the sensor plugged in?" card. Tick "Unplug the sensor" on the right to try it.
  4. Direction: stand behind the robot and look forward. Line on the left = negative, line on the right = positive. Channel 1 is on the far left.
  5. The EV3 screen only shows English letters and numbers. Use short English labels in LCD.Text (for example POS, WIDTH). Add a few spaces at the end to cover a longer number from last time.
  6. What clev3r cannot read: line segments (the EV3 does not get them). The bitmap, ID and firmware version (modes 3 and 5) need sensor firmware v4.0 or later.