<< return to Pixycam.com

Pixy cam Line Follow


hey what’s up guys, i’ve a projet with a team and my part is the “PixyCam” and i want to know where can i find help on the pixycam lin follower , so can you help me plz

Sry for bad anglish, i’m french

Thx, have a nice day


A line following robot? You might check out this page:




Hi thx for help, but how can we do without the Zumo robot, we use a robot base


If you want to use a different base (other than Zumo) but still use the PIxy2 Arduino sketches (e.g. line_zumo_demo), you will need to modify the parts of the sketch set the wheel velocities to work with the base that you choose (and not Zumo).



Hi sorry but i m a beginer so i don’t understand verry well
And i have a question, is it possible to take the barcode information from the serial monitor, and then make "if barcode 0=1 then do …( something with the speed of our motor )
Is there a program witch the pixycam follow a line with 3 ways, 1 for the left way and the right way and the way forward

thx for answers


I foudn the program the take the informations from the barcode :
// If barcode, acknowledge with beep, and set left or right turn accordingly.
// When calling setNextTurn(), Pixy will “execute” the turn upon the next intersection,
// making the left or right branch in the intersection the new main vector, depending on
// the angle passed to setNextTurn(). The robot will then follow the branch.
// If the turn is not set, Pixy will choose the straight(est) path by default, but
// the default turn can be changed too by calling setDefaultTurn(). The default turn
// is normally 0 (straight).
buzzer.playFrequency(2000, 100, 15);
// code==0 is our left-turn sign
if (pixy.line.barcodes->m_code==0)
pixy.line.setNextTurn(90); // 90 degrees is a left turn
// code==5 is our right-turn sign
else if (pixy.line.barcodes->m_code==5)
pixy.line.setNextTurn(-90); // -90 is a right turn

Execpt that i will use a motor witch work on pwm so i will see that with my mates

And thx a lot u helped me a lot


Hello Renzo,
That is a good section of code to be looking at. If you are just starting out, the best way to get something working is to start with the example code and make small changes. In other words, experiment :slight_smile:

Your changes to the code may result in something no longer working – the robot may no longer move, or it may no longer follow the line, but you can always go back to the last set of changes that did work. You won’t break anything permanently by writing code that doesn’t work. We guarantee no smoke or fire :slight_smile:

Here is a the line tracking API, which is a good reference, in case you haven’t seen:




Hi thx for answer, i try the pixy and i try to do a “when barcode0 turn on the led on the arduino” but it doesn’t work, i don’t understand why, and i see this doc but i dont’t understand everything verry well


Hi, I have a project in which I must use the line pixy program and the color blocks as well. Is there any way I can ‘combine’ the settings of both to track the line and see color objects?


Hi Daniela,

unfortunately you can’t use both modes at the same time.