6.f. Orangutan LED Control Functions

Overview

These functions allow you to easily control the LED(s) on the 3pi Robot, the Orangutan LV-168, and the Baby Orangutan B. The 3pi Robot has two user LEDs on the bottom of the board: a red LED on the left and a green LED on the right. Additional LEDs included with the 3pi may be soldered in on the top side for easier viewing. The Orangutan LV-168 has two user LEDs: a red LED on the bottom left and a green LED on the top right. The Baby Orangutan B has a single, red user LED.

C++ users: See Section 5.d of Programming Orangutans from the Arduino Environment for examples of this class in the Arduino environment, which is almost identical to C++.

Complete documentation of these functions can be found in Section 9 of the Pololu AVR Library Command Reference.

This library comes with an example program in libpololu-avr\examples\led1.

1. led1

A simple example that blinks the LEDs on the 3pi, LV-168, or Baby Orangutan B.

#include <pololu/orangutan.h>

/*
 * led1: for the Orangutan LV-168 or Baby Orangutan B
 *
 * This program uses the OrangutanLEDs functions to control the red and green
 * LEDs on the Orangutan LV-168.  It will also work to control the red LED
 * on the Baby Orangutan B (which lacks a second, green LED).
 *
 * http://www.pololu.com/docs/0J20/6.f
 * http://www.pololu.com
 * http://forum.pololu.com
 */

int main()
{
  while(1)
  {
    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
  }
}