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);
}
}