PaulS:
OK. Sentences starts with a capital letter. Plz is not a word. Please is.
Sorry for that.. I'm not good at English..
PaulS:
You have not posted any code. You have not described the environment in which the XBees are operating. You have not defined how the XBees are configured. You have not defined how the XBees are connected to the Arduinos.
You can, therefore, not reasonably expect help.
Here is my situation and settings.
Receive module:
Arduino Uno - XBee sheid - XBee PRO S1
XBee settings : baudrate 57600 and others are default settings.(means AT communication mode)
Sending modules:
Arduino Uno - XBee sheid - XBee PRO S1
XBee settings : baudrate 57600 and others are default settings.(means AT communication mode)
Receiving sketch in Arduino Uno
//Data Receiver
byte Receive[7];
int x,y,z;
void setup()
{
Serial.begin(57600);
delay(1000);
}
void loop()
{
Switch();
delay(10);
}
void Switch()
{
if(Serial.available())
{
char inByte=Serial.read();
switch (inByte) {
case 0xAA:
getdata();
break;
case 0xAB:
getdata();
break;
case 0xAC:
getdata();
break;
case 0xAD:
getdata();
break;
default:
Serial.println("NON");
break;
}
}
}
void getdata()
{
for(int i=0;i<6;i++)
{
Receive[i]=Serial.read();
}
x=((Receive[0]<<8)|Receive[1]);
y=((Receive[2]<<8)|Receive[3]);
z=((Receive[4]<<8)|Receive[5]);
Serial.println(x);
Serial.print(y);
Serial.print(z);
Serial.println();
}
Sending module A sketch in Arduino
void setup()
{
Serial.begin(57600);
delay(1000);
}
void loop()
{
accelvalue();
//Serial.println();
delay(10);
}
//send 30000,27000,20000 value
void accelvalue()
{
byte id=0xAA;
byte xH=0x75;
byte xL=0x30;
byte yH=0x69;
byte yL=0x78;
byte zH=0x4E;
byte zL=0x20;
char data[7]={
id,xH,xL,yH,yL,zH,zL };
for(int i=0;i<6;i++) Serial.print(data[i]);
}
These sketches are made for checking correct communication is available over 100Hz.
As you can see over the sketches, if SenderA module sending 7 byte starting with id (0xAA), Receiving module checks first byte to identify which module sent the message. After that, Receving modules receives accelation values in 6 byte.
However, when I did this sketch, there are many NON and not vaild values in Serial moniter.
I think these sketch are simple to operate over 100Hz, however, it couldn't working over than 100Hz.
Can you give me some advice?
Thanks.
Receiver.ino (760 Bytes)