Go Down

Topic: Arduino Leonardo and Xbee series 1 wireless communication (Read 1 time) previous topic - next topic


Jan 29, 2013, 02:03 am Last Edit: Jan 29, 2013, 02:18 am by 33chen Reason: 1

Could someone tell me how to receive data from XBee series 1 on Arduino Leonardo ?
I can receive any data from my xbee transmitter which is connected with a  potentiometer, and totally get lost... Any correction on my code would be sincerely appreciated.

My enviroments.
- Arduino Leonardo
- two XBee (Series 1)
- XBee shield from https://www.sparkfun.com/products/9976
- XBee Explorer Regulated https://www.sparkfun.com/products/11373?
- a potentiometer

two Xbees are well configured using X-CTU software (from digiKey) and has been tested without using leonardo. Right now I have my xbee receiver connected to leonardo through xbee shield. I would like to use a code to achieve voltage readout from my potentiometer which is connected with my xbee transimtter. Potentiometer voltage signal sends to DIO pin in xbee transmitter. 3.3V DC power is supplied to both Xbee trasmitter and potentiomter. And 3.3V pin and RES on my xbee transmitter has been wired together.

I followed the advice from this thread ( http://arduino.cc/forum/index.php/topic,114936.0.html). physically connect a 100uF capacitor (monolithic type, no polarity issue involved) the 3.3v pin and RES on my xbee receiver (which is what they call the shield's xbee) and run a IDE code looking like below:

Code: [Select]
void setup() {
  while(!Serial){}; //required for the Leonardo

void loop() {
    Serial1.write(Serial.read());// input from Serial to Serial1
    Serial.write(Serial1.read()); //input from Serial1 to Serial

  // read the input pin:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (3.3 / 1023.0);
  // print out the value you read:

Let me know what I should do next. Thanks a lot.


Go Up