Support » Programming Orangutans and the 3pi Robot from the Arduino Environment » 5. Arduino Libraries for the Orangutan and 3pi Robot »
5.d. OrangutanLEDs - LED Control Library
Overview
This library allows you to easily control the LED(s) on the 3pi robot, Orangutan SV-xx8,.
You do not need to initialize your OrangutanLEDs object before use. All initialization is performed automatically when needed.
All of the methods in this class are static; you should never have more than one instance of an OrangutanLEDs object in your sketch.
OrangutanLEDs Methods
Complete documentation of this library’s methods can be found in Section 6 of the Pololu AVR Library Command Reference.
Usage Examples
This library comes with an example sketch that you can load by going to File > Examples > OrangutanLEDs.
1. OrangutanLEDExample
Alternately blinks the red and green LEDs on the Orangutan SV-xx8, Orangutan LV-168, or 3pi robot. If you run this program on the Baby Orangutan B, you will only see the red user LED blink, but you can connect an external LED to pin PD7 (Arduino pin 7) if you want to see the second LED blink. If you do this, don’t forget to include a current-limiting resistor!
#include <OrangutanLEDs.h> /* * OrangutanLEDExample: for the 3pi robot, Orangutan LV 168, Orangutan SV-xx8, *). */ OrangutanLEDs leds; void setup() // run once, when the sketch starts { } void loop() // run over and over again { leds.red(HIGH); // red LED on delay(1000); // waits for a second leds.red(LOW); // red LED off delay(1000); // waits for a second leds.green(HIGH); // green LED on (will not work on the Baby Orangutan) delay(500); // waits for 0.5 seconds leds.green(LOW); // green LED off (will not work on the Baby Orangutan) delay(500); // waits for 0.5 seconds }