I have an arduino mega and an uno, mega has an xbee s2c as coordinator and uno an xbee s2c as router, both in AT ( transparent ) mode. When I send integers from uno with Serial.write() coordinator receives just fine, but when i try float, negative numbers and chars, i get still integers but as I found out sending chars it is in ASCII. I tried Serial.print() but no result. Is there a way to send a negative float from one xbee to the other in AT mode?
Coordinator code
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial1.begin(9600);
Serial.println("Comersing test!");
}
void loop() {
if(Serial1.available()>0){
Serial.print(Serial1.read());
}
}`
UNO code
#include <SoftwareSerial.h>
SoftwareSerial xbSerial(8, 7); // RX, TX
void setup() {
xbSerial.begin(9600);
xbSerial.write("First data sent!");
}
int x=4;
void loop() {
// put your main code here, to run repeatedly:
xbSerial.write(x);
x++;
delay(1000);
delay(1000);
delay(1000);
}
if I change x in Uno to float, negative or char, I get weird values.