6.a. Example program - AVR Studio

A very simple demo program for the Orangutan is available in the folder examples\simple-test.

Double-click on the file test.aps, and the project should open automatically in AVR Studio, showing a C file that uses a few basic commands from the Pololu AVR Library:

AVR Studio showing the sample program.

To compile this program, select Build > Build or press F7. Look for warnings and errors (indicated by yellow and red dots) in the output displayed below. If the program compiles successfully, the message “Build succeeded with 0 Warnings…” will appear at the end of the output, and a file test.hex will have been created in the test\avr-studio-project\default folder.

AVR Studio build window, compiling the example project.

Connect your Orangutan Programmer to your computer and your Orangutan board, and turn on the Orangutan’s power. The green status LED close to the USB connector should be on, while the other two LEDs should be off, indicating that the programmer is ready.

Select Tools > Program AVR > Connect to connect to the Orangutan Programmer. The default options of “STK500 or AVRISP” and “Auto” should be fine, so click Connect and the AVRISP programming window should appear.

You will use AVRISP to load test.hex into the flash memory of your AVR. To do this, click “...” in the Flash section and select file test.hex that was compiled earlier. Note that you have to first navigate to your project directory! Now click “Program” in the Flash section, and the test code should be loaded onto your Orangutan.

Programming the Orangutan from AVR Studio.

If your Orangutan was successfully programmed and you are using an Orangutan LV-168, you should hear a short tune, see the message “Hello!” on the LCD (if one is present and the contrast is set correctly), and the LEDs on the board should blink. If you are using a Baby Orangutan B, you will just see the red user LED blink.

In case you are having trouble performing the compilation, precompiled hex files for this example and all of the other examples included with the C/C++ library are available in examples\hex-files. You can load these hex files onto your controller using AVR Studio as described above.