I'm trying to make the 3pi-linefollower example work. I successfully compiled the program. I'm using the latest libpololu-avr-100607.zip. I use the Makefile provided with the example code (modified to find the libraries in my local installation path). Everything seems fine. However, at the beginning of the program, the robot moves forward and backwards instead of doing it to the right and to the left (trying to find the "line). I even wrote a very simple program:
- Code: Select all
#include <stdio.h>
#include <string.h>
#include <pololu/3pi.h>
#include <util/delay.h>
/* Program entry point */
int main(int argc, char **arv)
{
/* The map */
for(;;) {
set_motors(128, 128);
_delay_ms(3000);
set_motors(0, 0);
_delay_ms(3000);
}
/* Back to system */
return 0;
}
In this case, one wheel turns clockwise and the other one does it counter clockwise. However if I write something like set_motors(x, -x), both wheels turn in the same direction.
What am I doing wrong? I remember I had this problem before, but it was fixed by disabling optimizations. This "fix" doesn't work for me in this case.
I'm using:
- avr-binutils-2.20_1
avr-gcc-4.3.4_2
avr-libc-1.6.8_2,1
avrdude-5.10
Any help is appreciated. Thanks in advance.

