Cyber Week Sale – click for coupon codes!

6. Orangutan LEDs

The OrangutanLEDs class and the C functions in this section are a very simple interface to the user LEDs included on Orangutan controllers and 3pi. The Orangutan X2 has five user LEDs (two red, two green, and one yellow), the Orangutan LV, SV, SVP, and 3pi have two user LEDs (one red and one green), and the Baby Orangutan has one user LED (red).

On all devices except the Orangutan X2, the red LED is on the same pin as the UART0 serial transmitter (PD1), so if you are using UART0 for serial transmission then the red LED functions will not work, and you will see the red LED blink briefly whenever data is transmitted on UART0.

On all devices except the Baby Orangutan, the green LED is on the same pin as an LCD data pin, and the green LED will blink briefly whenever data is sent to the LCD, but the two functions will otherwise not interfere with each other. On the Orangutan X2, all the user LEDs are LCD data pins, so they will briefly flash whenever data is sent to the LCD, and the LCD can sometimes drive these LEDs if the AVR pins they are on are configured as inputs (their default configuration). To stop the LCD from keeping the LEDs lit, you can use the functions in this library to explicitly turn them off at the start of your program, which will make the AVR pins driving-low outputs.

For a higher level overview of this library and example programs that show how this library can be used, please see Section 3.e of the Pololu AVR C/C++ Library User’s Guide.

Reference

C++ and Arduino methods are shown in red.

C functions are shown in green.

static void OrangutanLEDs::red(unsigned char state)

void red_led(unsigned char state)

This method will turn the red user LED off if state is zero, it will toggle the LED state if state is 255, else it will turn the red user LED on. You can use the keyword HIGH as an argument to turn the LED on, and you can use the keyword LOW as an argument to turn the LED off. You can use the keyword TOGGLE to toggle the LED state.

Example:

red_led(HIGH);
// in C++: OrangutanLEDs::red(HIGH);  // turn the red LED on

static void OrangutanLEDs::green(unsigned char state)

void green_led(unsigned char state)

This method will turn the green user LED off if state is zero, it will toggle the LED state if state is 255, else it will turn the green user LED on. You can use the keyword HIGH as an argument to turn the LED on, and you can use the keyword LOW as an argument to turn the LED off. You can use the keyword TOGGLE to toggle the LED state. The Baby Orangutan does not have a green user LED, so this function will just affect the output state of user I/O pin PD7.

Example:

green_led(LOW);
// in C++: OrangutanLEDs::green(LOW);  // turn the green LED off

static void OrangutanLEDs::left(unsigned char state)

void left_led(unsigned char state)

For the Orangutan LV, SV, X2, Baby Orangutan, and the 3pi, this method is an alternate version of red(). The red LED is on the left side of most of these boards. For the Orangutan SVP, this method is an alternate version of green().

static void OrangutanLEDs::right(unsigned char state)

void right_led(unsigned char state)

For the Orangutan LV, SV, X2, Baby Orangutan, and the 3pi, this method is an alternate version of green(). The green LED is on the right side of most of these boards. For the Orangutan SVP, this method is an alternate version of red().

static void OrangutanLEDs::red2(unsigned char state)

void red_led2(unsigned char state)

This method controls the Orangutan X2’s second red user LED and is only defined for the Orangutan X2 version of the library. You can use the keyword HIGH as an argument to turn the LED on, and you can use the keyword LOW as an argument to turn the LED off. You can use the keyword TOGGLE to toggle the LED state.

static void OrangutanLEDs::green2(unsigned char state)

void green_led2(unsigned char state)

This method controls the Orangutan X2’s second green user LED and is only defined for the Orangutan X2 version of the library. You can use the keyword HIGH as an argument to turn the LED on, and you can use the keyword LOW as an argument to turn the LED off. You can use the keyword TOGGLE to toggle the LED state.

static void OrangutanLEDs::yellow(unsigned char state)

void yellow_led(unsigned char state)

This method controls the Orangutan X2’s yellow user LED and is only defined for the Orangutan X2 version of the library. You can use the keyword HIGH as an argument to turn the LED on, and you can use the keyword LOW as an argument to turn the LED off. You can use the keyword TOGGLE to toggle the LED state.

Related Products

Pololu 42×19mm Wheel and Encoder Set
Encoder for Pololu Wheel 42x19mm
Orangutan SVP-1284 Robot Controller (assembled)
Orangutan SVP-1284 Robot Controller (partial kit)
Orangutan SV-168 Robot Controller
Baby Orangutan B-328 Robot Controller
QTR-L-1A Reflectance Sensor (2-Pack)
QTR-L-1RC Reflectance Sensor (2-Pack)
QTR-3A Reflectance Sensor Array
QTR-3RC Reflectance Sensor Array
QTR-1A Reflectance Sensor (2-Pack)
Orangutan LV-168 Robot Controller
Orangutan SVP-324 Robot Controller (partial kit)
QTR-1RC Reflectance Sensor (2-Pack)
Orangutan SV-328 Robot Controller
Pololu 3pi Robot
Baby Orangutan B-48 Robot Controller
QTR-1A Reflectance Sensor
QTR-1RC Reflectance Sensor
Orangutan SVP-324 Robot Controller (assembled)
QTR-8A Reflectance Sensor Array
QTR-8RC Reflectance Sensor Array
Orangutan X2 with VNH3
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors