Hi guys,
I am working on a project where I am trying to measure acceleration data wirelessly. This is my equipment:
Arduino UNO
ADXL 345 accelerometer
Xbee Shield from sparkfun
Xbee Explorer from sparkfun
2 Xbee series 1 wireless modules
The acceleration data is displayed correctly when Arduino is connected, but when I try to receive the data wirelessly with XCTU software, all I get is an infinite string of hexadecimal characters and the ASCII values.
I usually use hyperterminal to store the data into a csv file so that I can process it later, but again, when I try the wireless connecction, weird nonsense characters appear instead of the values I want.
How can I modify my code or my xctu configuration to obtain the values in decimal notation so that I can process them?
This is the code that I uploaded to the Arduino board:
#include <Wire.h>
#include <ADXL345.h>
#include <SoftwareSerial.h>
ADXL345 adxl; //variable adxl is an instance of the ADXL345 library
SoftwareSerial XBee(2, 3); // RX, TX
int x,y,z; //Boring accelerometer stuff
unsigned long Time; //time vector
int dt; //sampling time
// variables of settings for ADXL345
int rangeval = 2; //2,4,8,16
bool fullResBit = 0;
double OutputDataRate = 800;
void setup()
{
// Set up both ports at 9600 baud. This value is most important
// for the XBee. Make sure the baud rate matches the config
// setting of your XBee.
adxl.powerOn();
adxl.setFullResBit(fullResBit);
adxl.setRate(OutputDataRate);
XBee.begin(9600);
}
void loop()
{
Time = millis(); //get the time in milli second
dt = 10; //sampling time in milli second
// set the sampling to
if ((Time % dt) == 0){
adxl.readAccel(&x, &y, &z); //read the accelerometer values and store them in variables x,y,z
// Output x,y,z values
XBee.write(Time);
XBee.write(",");
XBee.write(x);
XBee.write(",");
XBee.write(y);
XBee.write(",");
XBee.write(z);
XBee.write('\n');
}
}
Thank you very much in advance