hiii every budy ... im having lettle problem with my xbee's /// cant send and receive float numbers /// im trying to send them as characters but cant convert them back to float number ... here is my tx and rx code:
//TX
void setup()
{
Serial.begin(9600);
}
void loop()
{
float d=50.1;
Serial.print(String('50.1'));
delay(3000);
}
And my RX :
//RX
void setup()
{
Serial.begin(9600);
}
String h[20];
void loop()
{
int i=0;
float d;
while(Serial.available()==0);
for(i=0;i<=20;i++)
{
h*=Serial.read()-'0';*
Reading 20 of the 1 bytes available is generally not a good idea.
You need to change your sender to use start- and end-of-packet markers. Then, you need to change the receiver to make use of those markers. This has been discussed on this forum many, many times.