my program is about to display data wireless. i have configure both of my xbee. my problem is, at the receiver part does not display same as the display at the receiver. i used 3 sensors. at the transmitter part, the serial monitor able to display the data like i wanted. but at the receiver the display in other form. please help me.
`` at the transmitter
#include <SoftwareSerial.h>
SoftwareSerial ss(2, 3); //(RX,TX)
#define trigPinL 8
#define echoPinL 7
#define IR 6
int MODE = 0;
int SensorPosition = 50; //set sensor position level to 50cm
float OilLevel = 0;
String LCDstatus = "NORMAL";
int Sens1;
float Temp;
int RPM;
int Sens1Pin = 1;
int RpmBeatCount=0;
int RpmCountDown=2000;
int sensor[3];
void setup() {
ss.begin(9600);
Serial.begin (9600);
pinMode(trigPinL, OUTPUT);
pinMode(echoPinL, INPUT);
pinMode(IR, INPUT);
}
void loop() {
//temp
Sens1 = analogRead(Sens1Pin); //read the value from the sensor
Sens1 = (5.0 * Sens1 * 100.0)/1024.0; //convert the analog data to temperature // this part do at receiver
Sens1 = (Sens1/10) + 10;
//oillevel
long durationL, distanceL, durationH, distanceH, MixDist;
float Feet;
digitalWrite(trigPinL, LOW); // Added this line
delayMicroseconds(2); // Added this line
digitalWrite(trigPinL, HIGH);
delayMicroseconds(10); // Added this line
digitalWrite(trigPinL, LOW);
durationL = pulseIn(echoPinL, HIGH);
distanceL = (durationL/2) / 29.1; //this part and below do at recever
// Feet = distanceL* 0.032808; //Convert CM to feet
OilLevel = SensorPosition - distanceL;
OilLevel = OilLevel/50 * 100;
//speed
while(RpmCountDown > 1){
if (digitalRead(IR) == 0){
RpmBeatCount = RpmBeatCount + 1;
}
while (digitalRead(IR) == 0){
}
RpmCountDown = RpmCountDown - 1;
delay(1);
if (RpmCountDown == 1000){
//Serial.print("X,");
//Serial.print(OilLevel);
//Serial.print(",");
//Serial.print(Sens1);
//Serial.print(",");
// Serial.print(RPM);
//Serial.print(",");
}
}
RPM = RpmBeatCount;
RpmBeatCount = 0;
RpmCountDown = 2000;
// Serial.print("Data Read,");
Serial.print(" oil level =");
Serial.print(OilLevel);
Serial.print(",");
Serial.print(" temperature =");
Serial.print(Sens1);
Serial.print(",");
Serial.print(" speed =");
Serial.print(RPM);
Serial.println(",");
}
`` at the receiver
#include <SoftwareSerial.h>
//int RPM = 0;// for incoming serial data
//int Sens1 = 0;
//int OilLevel = 0;
char inbyte = 0;
void setup() {
Serial.begin(9600); //opens serial port, sets data rate to 9600 bps
}
void loop (){
//send data only when u receive data
if(Serial.available()>0) {
//read the incomingByte
inbyte = Serial.read();
//say what you got
Serial.print(" data receive = ");
Serial.print( inbyte );
Serial.print('.');
Serial.println();
}
}
XbeeDragRacing.ino (2.03 KB)