I have been facing some problem with my project, the project is about receiving values captured by the adxl335 accelerometer and sending via zbee transmitter to ma mac.
The problem i am facing is that , when i transmit the values , n try to display it in the serial monitor , the values are getting limited between 55,50,51,40....much of the time its showing 50 and 55, even though i try to move the accelerometer as fast as possible.
I am totally new to arduino , and more over this is my 1st post. My code must be the simplest you have ever seen , i am posting this cos i have no one to clear this thing for me , and that i need to get this done .
Transmitter code: [edit - moderator - to use code boxes]
Code: Select all
#include <NewSoftSerial.h>
NewSoftSerial xbee(9,8);
const int xpin = 0; // x-axis of the accelerometer
const int ypin = 1; // y-axis
const int zpin = 2; // z-axis (only on 3-axis models)
unsigned int tot,data_tx;
void setup()
{
// initialize the serial communications:
Serial.begin(9600);
xbee.begin(9600);
}
void loop()
{
data_tx = analogRead(xpin);
xbee.print(data_tx);
// delay before next reading:
delay(400);
}
Code: Select all
#include <NewSoftSerial.h>
NewSoftSerial xbee2(9,8);
void setup()
{
// initialize the serial communications:
Serial.begin(9600);
xbee2.begin(9600);
}
void loop()
{
if(xbee2.available() )
{
Serial.println(xbee2.read());
Serial.print("is rxvd");
Serial.print("\n");
}
// delay before next reading:
delay(400);
}