C++ Libraries & Content (Function) Listing

I am new to C, though I have programmed everything from the TRS-80 to mainframes, and understand, Basic, Fortran, COBOL and Assembly language. But it’s been a while. I was able to copy the simple line following code and using Atmel Studio get it into my 3Pi. But here’s my questions, and it may expose my ignorance a bit here.

I understand that when I want to set a motor speed, or query the sensor, and refer to them with Polulo’s function name, that Polulo has placed code into the C library.

If I buy a proximity sensor, lets say from Polulo, is that in the library, or will I have to learn bit level code for the sensor and somehow get it into the library? Suppose the sensor was bought from some other manufacturer?

Second, is there a way to get a listing of every function in the library so I can see all the tools available to me?

Last, when I loaded the line follower into the 3Pi it obviously overwrote the Demo code that 3Pi came with. How can I get a copy of that code? My intent here would be to append, at the front of all new code, the Demo code. I understand that would mean selecting at startup of 3Pi whether I wanted the Demo, a Line Follower or a Maze Solver, etc, but that way, unless I run out of room, I could have more than one program available to me at all times I wanted to run it through its paces.


Excuse me if the questions are at the newbie level, which I truly am in robotics and C, but if you can direct me to a source where I could learn more about these things that would be great too.


You can see all the functions in the Pololu AVR C/C++ Library by looking at the source code. The source code gets installed on your computer by the library’s installer, and you can also see the Pololu AVR C/C++ Library source code on github. However, it is probably more productive to read the library’s user’s guide and comand reference on our website. Those, along with the Pololu 3pi Robot User’s Guide, should be your main resources for progamming the 3pi. I think you should also check out our Sample Project: 3pi Wall Follower.

The answer to the proximity sensor question depends on exactly which sensor you buy. Many of them have a simple-enough interface that you can just read them like any other analog or digital input and you do not need special library support or bit-level programming.

The program the 3pi comes with is called “3pi-demo-or-serial-slave” and its source code comes along with the source code for the library.


Thanks for the reply. I’ve looked at these forums and they are the best I’ve seen, both from Pololu’s support as well as the users themselves. Great work!