Hi all, I’m finally starting to program my 3pi. I uploaded the “Line following” code onto my 3pi and when it calibrates it goes straight back and forth instead of left/right. I fixed the code to say:
That fixed the problem for the calibration, but then after it got going to follow the black line. It just went in a circle, so I played with the code again and let: set_motors(100,-100) for a straight line. It’s working fine now, but why does this seem backwards?
Can you simplify your code down the a program that just drives the motors forward and does not do anything else? Does set_motors(50,50) run both motors forward in this case?
Sorry, it sounds like your motor was accidentally installed in the wrong orientation and slipped through our tests. There are a couple of possible solutions: you can write a wrapper function that inverts the values of set_motors. Something like:
void my_set_motors(int m1Speed, int m2Speed)
{
set_motors(m1Speed,-m2Speed);
}
Another option would be to redefine set_motors in the AVR library and recompile it.
Could you please post the serial number of your 3pi so we can investigate its manufacturing history?