<< return to Pixycam.com

Adding new barcodes to pixy2 zumo

Can anyone please help me by showing me how to add extra barcodes to pixy line prog. I left and right turns but would like to add the other barcodes from no. 1 to 15 but cannot get this to work have trised and tried different ways but no luck please help me Mike

Hello Michael,
The demo use codes 0 and 5 – here’s the complete program for reference:

But in particular, the important lines:

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 

To add new codes, you need to print out different codes and add them to your code — for example here’s what a “stop” code might look lke:

if (pixy.line.barcodes->m_code==1)  // stop
{
    motors.setLeftSpeed(0);
    motors.setRightSpeed(0);      
}

The codes can be found here (or via the downloads page):

The barcodes can be printed out as-is, or you can add artwork to them to make them human-readable as well.

Hope this helps!

Edward

Thanks for helping Edward I have tried adding your new code but I am getting error---- class Zumo Motors has no member named set —do you have any idea why I get this Mike

Still no luck with extra barcodes allI get is error message have tried for hours Mike

Hello Michael,
Copy the exact error you’re getting in your message.

It it’s saying “no member named set”, it would be because there is no member named “set”. The code I suggested called “setLeftSpeed” and “setRightSpeed”. But my code wasn’t intended as an exact set of instructions. How is your C programming? It sounds like you might be struggling with the C language.

Edward

1 Like

Hi Edward
The error message reads ‘class Zumo Motors’ has no member named ‘set’ does this help
Mike

Well, I agree with the compiler that class ZumoMotors has no member named ‘set’.

This isn’t a particularly difficult error to track down, which is why I asked you about your C programming. You might have a friend or colleague who knows C take a look at your code.

Edward

Thanks for trying to help I am very new to this and I thaught I would be able to use this without helpas I do not no very much about codes but it looks like I will not be able to use these extra codes.
Mike