3pi delay_ms(100); won't work!

I’ve FINALLY got my 3pi going with Eclipse, sort of.

I had to scale all the way down to the red/green LED blink program, and then the delay routine wasn’t accepted. I had the pololu/orangutan.h header file.

By deleting them I got the leds to come ON. :slight_smile:

Help me make them blink!

This old dog is having trouble learning new tricks. Starting with computers in the 70’s everyone said learning C was ‘the way to go’. It looked awful to me, so I stuck with assy, fortran, basic, etc. Now at 72 I’m going to try to learn it (AND Android stuff).


Hi Bo,

Could you please post the complete, non-working code, and describe exactly what it does (and what it should do)? Thanks!



Is there a reason you are not using Atmel Studio 6? Are you not using Windows?

- Ryan

Here’s the original program:

#include <pololu/orangutan.h>

 * led1: for the Orangutan LV, SV, SVP, X2, Baby-O and 3pi robot.
 * This program uses the OrangutanLEDs functions to control the red and green 
 * LEDs on the 3pi robot or Orangutan.  It will also work to control the red
 * LED on the Baby Orangutan B (which lacks a second, green LED). 
 * [pololu.com/docs/0J20](https://www.pololu.com/docs/0J20)
 * [pololu.com](https://www.pololu.com)
 * [forum.pololu.com](https://forum.pololu.com)

int main()
    red_led(1);               // red LED on
    delay_ms(1000);           // waits for a second
    red_led(0);               // red LED off
    delay_ms(1000);           // waits for a second
    green_led(1);             // green LED on (will not work on the Baby Orangutan)
    delay_ms(500);            // waits for 0.5 seconds
    green_led(0);             // green LED off (will not work on the Baby Orangutan)
    delay_ms(500);            // waits for 0.5 seconds

I get an ‘undefined reference’ to delay_ms, no matter how/where I put the pololu/orangutan.h path in the includes. I even put in C:\winavr\libpololu/pololu/orangutan.h in the program.

I decided to use Eclipse since I’m going to try to learn Android programming at the same time, with a goal of controlling the 3pi with my Galaxy s3 phone. A big order, since I’m getting old and the brain cells seem to nap too much or something.

Thanks for your patience and help.

Experimenting with the other 3pi examples gives the same problem.
All of the function calls give the error.
I’ve checked the Windows path, and location of the pololu files and think all is correct. I eliminated all the ‘includes’ I had added.

Totally stuck. :slight_smile:


I think you will find it much easier to get going if you try using Atmel Studio 6 for AVR programming and save Eclipse for the Android programming. I suggest following our Pololu AVR Programming Quick Start Guide.

- Ryan

Hello, Bo. The ‘undefined reference’ error is caused by not supplying the correct type of -l argument during linking. If you really want to use Eclipse, you will need to (1) learn what command-line options are necessary for avr-gcc during compiling and linking, and (2) configure Eclipse to use those options. For help with (1), please see the “Using the Pololu AVR Library for your own projects” section of the Pololu AVR C/C++ User’s Guide.

But, as Ryan said, it will be easier to just following the Pololu AVR Programming Quick Start Guide because we have already made a series of nice installers and templates that should help you get up and running quickly, without having to know anything about compiler options.


thanks so much for the advice! i have switched and got 2 of the examples to build/run… i have 2 questions/notes that may be of value to others & will post it in a new note. thanks again. Bo