GoPiGo Line follower - Help

Hi all,

I am new to using a GoPiGo and have managed to get the servo and distance sensor working. I am now trying to master the line following but havent had any luck.

I look at this forum and tried these programs but these didn’t run on the robot

Can anyone please direct me to where I can find some sample python code so I can start programming the line sensor? I tried the below code but it didn’t work

import time
from easygopigo3 import EasyGoPiGo3

# initialize an EasyGoPiGo3 object
gpg3_obj = easy.EasyGoPiGo3()

# and then initialize the LineFollower object
line_follower = gpg3_obj.init_line_follower()

# use it however you want it
line_status = line_follower.read_raw_sensors()

I also have a flashing red light on the board, is this normal?


Thank you as always


when I try to import the line sensor, I get the following error as well


HI team,

Whilst I was for people to reply in this forum, I have been through quite a few of the sample programs today but I am still unable to get the line follower to respond in Python. If you can direct me or advise of some sample code to get it running, I can hopefully figure it out from there.

I am wondering what is wrong as it doesn’t allow me to import line_sensor.

Thanks for your help in advance


I would actually suggest you launch the python console/program with python command and not python3. Can you please try that? If my memory helps, python3 doesn’t belong to the conda environment where all these packages are installed, but python executable does.

Finally, if the GoPiGo3 power button is flashing red, then it means there’s no battery pack connected to it that has a voltage high enough to drive the motors.

Thank you!

Hi Robert

Thanks for your reply, I can confirm that it still does work with Python, the flashing red light was on the line follower not on the dexter board, I have figured out this is normal.

Can you advise what I should do next? I would like to get started with the line follower with a basic python program, any suggestions would be appreciated.



I have made a couple of edits this morning but I am still getting an error, please can you advise?

I am unable to run any program in the github repository on the GPG3


This is a known bug in DexterOS. @cleoqc has a patch available for DexterOS 2.2.2 if you PM directly.

See [Errno 13] Permission denied: ‘/home/pi/Dexter/black_line.txt’ for more details.