Programming Xbee

hello all ,

I would like to know how to send an address followed by a value of a potentiometer by Xbee . The XBee are already involved . The second XBee will read the address and if it's address and Leave the a read value.

Thanks

I would like to know how to send an address ... by Xbee .

The address of what? Using which XBees? Configured how? Connected how?

I use 2 xbee Serie 1 , they were XCTU parameters and communicate well with each other. we procedé several test.
We have established a program to send an address ( address is 0 ) and a value of the potentiometer .
We do not get reception program.

Here is the transmission :

// Transmitter
// ID 0104
// MY E001
// DH 0
// DL FFFF

const int Adresse0 = 00;
const int Adresse1 = 01;
const int Adresse2 = 10;
const int Adresse3 = 11;
int pot= A0;
int valeurPot= 0;

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

void loop() {

valeurPot = analogRead(pot);
Serial.print(Adresse0);
delay(100);
Serial.println(valeurPot);
delay(100);

}

And of reception does not work :

// Receiver train
// ID 0104
// MY B001
// DH 0
// DL E001

char msg = ’ ';
int val = 0;
const int Adresse0 = 00;
int valeurPot = 0;
int led = 13;

void setup() {
Serial.begin(9600);//Remember that the baud must be the same on both arduinos
pinMode(13,OUTPUT);
}

void loop() {
while(Serial.available() > 0) {

msg=Serial.read();
if (msg== Adresse0,valeurPot){
digitalWrite(led , HIGH );
}
else{
digitalWrite(led , HIGH );
delay(100);
digitalWrite(led , LOW);
delay(100);

}

}
}

Thanks you for your help

Most people do NOT use broadcast mode. Why are you? Set MY on one to DL on the other. Neither value should be 0 or FFFF.

if (msg== Adresse0,valeurPot){

What is this nonsense? You are completely misusing the comma operator.

The delay between sending the address and the value is stupid. Get rid of it.

Send a delimiter between the address and the value. Read ALL the data, and store it, until the end-of-packet marker arrives. Then, parse the data in the array. You are NOT sending ONE character for the address and value. It makes no sense to assume that you can store the address and value in one character on the receiving end.

Can tell us as does a value separator ? We are beginners arduino ...

Thanks You

Can tell us as does a value separator ?

Look at the above sentence. There are 7 useful separators and one useless one. The spaces are separators. Theykeepwordsfromrunningtogetherinameaninglessmess.