Currently I'm stuck sending data from one xbee series1 to another xbee series1 (both are connected to an Arduino unor3). Here is the program for sending data.
#include <eHealth.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
float temperature;
char xbeedata[4];
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
temperature = eHealth.getTemperature();
memcpy(xbeedata, &temperature, 4); // send data
Serial.print("Temperature (ºC): ");
Serial.print(temperature, 2);
Serial.println("");
delay(1000); // wait for a second
}
the program for the receiving end is
#include <eHealth.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
float temperature;
char *xbeedata[4];
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
temperature = eHealth.getTemperature();
memcpy(&temperature, xbeedata, 4); // receive data
Serial.print("Temperature (ºC): ");
Serial.print(temperature, 2);
Serial.println("");
delay(1000); // wait for a second
}
Am I lacking things? I'm supposed to send the float like this float temperature->byte array ->xbee(send) -> xbee(receive) -> byte array -> float temperature ->
display on serial monitor. I'm currently using the Arduino IDE.