DFRobot_Leonardo_with_Xbee_R3_SKU_DFR0221_-DFRobot

Introduction

DFRobot Leonardo with Xbee socket is an Arduino Leonardo variant processor.The Arduino Leonardo is based on the ATmega32u4 chip. It is the latest addition to the Arduino family. Compared with the earlier Arduino controllers,by using the ATmega32U4 as its sole microcontroller, allows the Leonardo to be cheaper and simpler to use.Also, because the 32U4 is handling the USB directly, code libraries are available which allow the board to emulate a computer keyboard, mouse, and more using the USB-HID protocol!

warning_yellow.png NOTE: This board is only supported in the latest Arduino IDE 1.0.1 or later version so you will also need to update the IDE.

Specification

Leonardo Pin Out

DFRduino Leonardo Pin Out

Xbee Tutorial

DFRobot Leonardo with Xbee R3 has a Xbee socket.It uses Serial1 to communicate with Leonardo.

Sample Code

// # Description:
// It is just used to test Leonardo module
// Write by Grey
// Input  "p" once time the led will be turn on;twice to turn off.
// It is controled by Serial1 Xbee side only. but you can check the status from serial port.

int ledPin=13;
int val;
int count=0;
void setup()
{
  pinMode(ledPin,OUTPUT);
  Serial.begin(9600);
  Serial1.begin(115200);  // Xbee Serial1 port baud rate should be set the same to the xbee baud rate
}
void loop()
{
  val=Serial1.read();    // read xbee Serial1 data
  if(-1!=val)           // "-1" means no data
  {

    if('p'==val){
      if(count==0)count=1;
      else if(count==1)count=0;
    }


    if(count==0){
      digitalWrite(ledPin,HIGH);  // Turn on
      Serial.println("LED ON");  // you can check the status from serial port.
      Serial1.println("LED ON"); //you can check the status from serial1 port(xbee).
    }
    else if(count==1)
    {
      digitalWrite(ledPin,LOW);    // Turn off
      Serial.println("LED OFF");  //you can check the status from serial port.
      Serial1.println("LED OFF"); //you can check the status from serial1 port(xbee).
    }
  }
}

Connection diagram

DFRduino Leonardo With Xbee DFRduino Leonardo With Xbee

More Documents

DFshopping_car1.png Get DFRobot Leonardo with Xbee R3(SKU:DFR0221) from DFRobot Store or DFRobot Distributor.

Turn to the Top