Error communication with 2 xbees

Hello everyone!

I have a problem, I am a beginner and I can not find the solution …

I have one Xbee module + Arduino + Accelerometer which should send two values ??(byte) to another Arduino + Xbee module

But I do not know how … I test something but the value received has nothing to do

Could you help me please?

Here is the code transmitter:

//Librairie
#include <LiquidCrystal.h>
//Config LCD
LiquidCrystal lcd( 12, 11, 5, 4, 3, 2) ;
//Tableau
byte tableau[2] = {0} ;

void setup(){
  Serial.begin(9600) ;
  lcd.begin(16, 2) ;
  lcd.print("Atom by STX") ;
}
void loop(){
  tableau[0] = analogRead(A0) ;
  tableau[1] = analogRead(A1) ;
  Serial.println(tableau[0]) ;                     //send values
  Serial.println(tableau[1]) ;
  lcd.setCursor(0,1) ;                              //LCD
  lcd.print("                ") ;
  lcd.setCursor(0,1) ;
  lcd.print("X= ") ;
  lcd.print(tableau[0]) ;
  lcd.setCursor(7,1) ;
  lcd.print("Y= ") ;
  lcd.print(tableau[1]) ;
  delay(750) ;
}

Here is the code recipient:

//tableau
byte tableau[2] = {0} ;

void setup()
{
  Serial.begin(9600) ;
}


void loop()
{
  if(Serial.available() > 0)
  {
    tableau[0] = Serial.read() ;
    tableau[1] = Serial.read() ;
    Serial.println(tableau[0]) ;             //i look values by IDE arduino
    Serial.println(tableau[1]) ;
    delay(750); 
  }
}

There really should be a stick for XBee questions. It does not good to tell us how many XBees you have if you don't tell us what KIND they are, and how YOU have configured them.

Nor does posting code when you can not say for certain that the XBees are even talking to each other.

These:

byte tableau[2] = {0} ;
  tableau[0] = analogRead(A0) ;
  tableau[1] = analogRead(A1) ;

don't go together. The analogRead function returns an int, not a byte. You are potentially losing data right there.

The Xbee are S2 The first is coordinator The second is end / device

The Xbee are S2

Yo, Jack. Another one for you...

UP