3pi errors in AVR studio

I just downloaded AVR library & WinAVR and followed step by step instruction on extracting the files. I tried to build the test filed line-follower and I am getting there errors below. Could some one advise? Thanks.

…/test.c:132: warning: implicit declaration of function ‘wait_for_button_release’
…/test.c:140: warning: implicit declaration of function ‘set_motors’
…/test.c:149: warning: implicit declaration of function ‘calibrate_line_sensors’
…/test.c:149: error: ‘IR_EMITTERS_ON’ undeclared (first use in this function)
…/test.c:161: warning: implicit declaration of function ‘read_line’
…/test.c:183: warning: implicit declaration of function ‘is_playing’
…/test.c: In function ‘main’:
…/test.c:203: error: ‘IR_EMITTERS_ON’ undeclared (first use in this function)
make: *** [test.o] Error 1
Build failed with 6 errors and 17 warnings…

Below is the example code that I am using, why am I getting errors. Could you assist?

#include <pololu/orangutan.h>

int main()

	play("L16 ceg>c");




	return 0;

// Local Variables: **
// mode: C **
// c-basic-offset: 4 **
// tab-width: 4 **
// indent-tabs-mode: t **
// end: **
../test.c:6: warning: implicit declaration of function 'print'
../test.c:8: warning: implicit declaration of function 'play'
../test.c:12: warning: implicit declaration of function 'red_led'
../test.c:13: warning: implicit declaration of function 'green_led'
../test.c:15: warning: implicit declaration of function 'delay_ms'
make: *** [test.o] Error 1
Build failed with 1 errors and 5 warnings...

It sounds like you have not properly installed the Pololu library. Did you manage to run the install.bat file after extracting the files? To confirm, can you check that there are files in C:\WinAVR-\avr\include\pololu where represents the version of WinAVR that you have installed? Also, what is the exact name of the test that you are trying to run, and how did you do it? (Did you make your own AVR Studio Project or use the one in the examples folder?)


Paul, thank for the reply. I used the test program from the lib/examples/168 folder. I downloaded the library from the Pololu web site. I also downloaded WinAVR from another site. Is WinAVR part of the library? Also I did not have a install.bat, the version that I downloaded only had an install that I was instructed to right click an run as administrator. I have on my computer C:\WinAVR 20090313\avr\include. Looks like the Pololu file is missing. Does the 3pi robot that I ordered come with the correct software or is it all online? I had the 3pi robot shipped to me express it should be here today.

I copied and pasted the pololu folder from the library into the include folder: C:\WinAVR 20090313\avr\include\pololu\examples\simple-test\test.c: I am getting an error:

Build started 4.6.2009 at 09:26:36
avr-gcc -mmcu=atmega168 -Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT test.o -MF dep/test.o.d -c …/test.c
avr-gcc -mmcu=atmega168 -Wl,-gc-sections -Wl,-Map=test.map test.o -lpololu -o test.elf
c:/winavr-20090313/bin/…/lib/gcc/avr/4.3.2/…/…/…/…/avr/bin/ld.exe: cannot find -lpololu
make: *** [test.elf] Error 1
Build failed with 1 errors and 0 warnings…
Could you assist? Thanks.

Hmm there shouldn’t be any folder called “lib/examples/168” (do you mean “libpololu-avr/examples/atmega168”?), and you still haven’t given me the exact name of the example. However, I think I can tell that something went wrong when you ran “install”. I have seen a couple of times that it doesn’t work correctly when run from your desktop - could you try extracting the download to C:\libpololu-avr instead, run install, and see if it works better? If that doesn’t work, you can copy libpololu_*.a to C:\WinAVR-20090313\avr\lib\ and everything should work.

The 3pi does not ship with any software - it’s all online.


Thanks Paul, what I did was uninstall WinAVR and the the zip files and started from scratch. I followed section 6 in the Pololu 3pi Robot User’s Guide and was able to get it going. Great learning experience. I am still in the infancy stage of learn C is there any source code for the line maze algorithm? Thanks.

Hello djman,

We have example maze solving code and an AVR Studio project in the same examples folder where you found the simple-test program: libpololu-avr/examples/atmega18/3pi-mazesolver/

Is that what you are looking for?

- Ryan

I was able to get the 3pi working using the example code. I am still in the infancy stage of learning C and some of the code is too advance with out some explanation. Is there a line-maze algorithm in a more basic form to learn from? Thanks.


Did you read through the maze-solving portion of the 3pi user’s guide? I don’t think you could simplify the code much more than the example does and still have a functioning maze solver. If it’s your familiarity with C that’s holding you back, perhaps you should look for some beginning C tutorials, or look at the simpler example programs included in the library for line following, using the LCD, etc.

- Ben

Thanks for the tips, I in the process of ordering a beginners C book.

Can a algorithm be created from scratch to solve the maze or is the examples\3pi-mazesolver all there is?

I’m not sure I understand your question. Are you asking if the example we provide is the only possible way to solve a maze?

- Ben

Yes, that is exactly what I am asking? Thanks.

The example we give is just one approach (the one we think is the simplest). Another approach that works with gridded mazes is to store the state of the maze at every grid point. It’s more complicated, it requires you be able to keep track of your position, and it takes more memory, but it lets you solve mazes with loops in them.

- Ben

Where can I find other approaches (source code) to solve the maze or is it all proprietary ?

Have you tried google?

Yes, google brings me back to Pololu.

I’m sure there are plenty of other google results besides Pololu. I have no idea what other resources are out there, but I’d be very skeptical if you told me Pololu was the only place to learn about maze-solving algorithms. Note that you probably won’t find much complete source code out there since an integral part of maze solving is actually driving through the maze and sensing the intersections, and that is completely dependent on the particular robot.

- Ben

Once the maze has been solved, is there a algorithm to restart the loop or would you just call the main() again? Thanks.