The simplest example for programming the Lithne is probably the Blink example, which is also commonly used for the regular Arduino. Just like the Arduino, the Lithne features a LED which can be addressed and controlled in the LithneDuino IDE. It can be addressed by using either LED_BUILTIN or by using the port number which is 41.

  Turns on an LED on for one second, then off for one second, repeatedly.
  This example code is in the public domain.
// The LED underneath the XBee can be addressed in the Arduino IDE by using LED_BUILTIN or 41.
// give it a name:
int led = LED_BUILTIN;
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second




The Lithne can also be used to control NeoPixel RGB LEDs, and other LEDs driven by WS2811 and WS2812(B) chips. Just download the latest version, connect your LEDs and set the parameters in the Arduino sketch. 


Further reference to the Adafruit NeoPixel family can be found here.

The most important settings that have to be set are:

  • The PIN to which the LEDs are connected, any digital pin can be used and can be refered to as Dx for example D1 in "#define PIN D1"
  • The other settings can be changed in:
    "Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800)"

    Parameter 1 = number of pixels in strip
    Parameter 2 = Arduino pin number (most are valid)
    Parameter 3 = pixel type flags, add together as needed:
    NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
    NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
    NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
    NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

Note: Do not forget to connect the Ground of the LEDs to both the Lithne and Power supply to prevent erratic behavior.

Note: Typically the NeoPixels need to be supplied with 5V, this is only possible using an external power supply and not in combination with the Power Shield. 3V3 also works well, but is limited to 500mA.

Note: When the NeoPixels are powered through the 5V supply of the Lithne keep in mind that it can only supply up to 1500mA. Meaning that up to 22 LEDs can be powered to full white, the current needed for random colors is typically 1/2 to 1/3 that of full white.