I have two Arduino Unos, one of which is connected to a HC-05 bluetooth device and a temperature reader, the other has just a HC-05 bluetooth and is expected to output temperature readings in serial monitor.
This is first device:
#include <SoftwareSerial.h>
const int tempPin = 1;
SoftwareSerial BTSerial(10, 11);
void setup() {
BTSerial.begin(38400);
Serial.begin(9600);
}
void loop() {
int value = analogRead(tempPin);
float mv = value * (3300/1024);
float x = (mv - 500)/100;
Serial.print("Temperature is: ");
Serial.println(x);
BTSerial.print(x);
delay(5000);
}
This is the second device:
#include<SoftwareSerial.h>
void setup() {
BTSerial.begin(38400);
Serial.begin(9600);
}
void loop() {
if(BTSerial.available())
{
float x = BTSerial.read();
Serial.println(x);
}
}
The first program is able to give me accurate readings (around (15 degress Celsius) but the second program gives readings between 40 - 60 *C (as well as that it spits out 5 different readings between delay intervals). Why is that? How should I change this so both devices output the same readings