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



How to upload this sketch to the Lithne via USB?

  • Make sure you have installed the custom LithneDuino IDE and that you have installed the drivers for the Lithne.
  • Connect the Lithne to your computer using a USB cable, the Lithne will be powered through the USB. Additionally it can be powered through a 12V or other suitable power supply, see Lithne Pinout Diagram.
  • Find out which COM port "Lithne Serial" uses
    • Windows In the start menu type: devmgmt.msc to open the device manager. If everything is installed correctly your Lithne should appear under “Ports (COM & LPT)” as “Lithne Serial (COMx)” and “Lithne Xbee direct (COMx)” note these COM ports.
    • Mac In terminal type ls /dev/tty.* it should display a list of devices including your Lithne.

Note: The COM port might change when you use a different USB port on your computer.

  • Paste the sketch above in the main window of the Lithne.
  • In Tools > Boards select Lithne and in Tools > Serial Port select the COM port which you found for “Lithne Serial”.
  • Press upload and your sketch should upload to your Arduino.