user43638: 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

user4143: Two problems:
Your first program sends an ASCII representation of the temperature with no line ending.  So after a few readings you get something like:
20.2520.2520.5021.0021.25

etc.  You need some line endings in there to break them up.
Secondly your second program reads one byte at a time as a number (float) and prints it - so would get something like:
50.00
48.00
46.00
50.00
53.00
50.00
48.00
... etc ...

You need to, in association with sending line endings in your first program, read each character of a single line either into a string and then parse that as a float (with dtostrf()) or directly into a float using a state machine.
You can read more about working with serial here and working with a number reading state machine here.

43638: <p>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.</p>

<p>This is first device:</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;
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);
}
</code></pre>

<p>This is the second device:</p>

<pre><code>#include&lt;SoftwareSerial.h&gt;
void setup() {
BTSerial.begin(38400);
Serial.begin(9600);
}
void loop() {
if(BTSerial.available())
{
float x = BTSerial.read();
Serial.println(x);
}
}
</code></pre>

<p>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</p>
 4143: <p>Two problems:</p>

<p>Your first program sends an ASCII representation of the temperature with no line ending.  So after a few readings you get something like:</p>

<pre><code>20.2520.2520.5021.0021.25
</code></pre>

<p>etc.  You need some line endings in there to break them up.</p>

<p>Secondly your second program reads one byte at a time as a number (float) and prints it - so would get something like:</p>

<pre><code>50.00
48.00
46.00
50.00
53.00
50.00
48.00
... etc ...
</code></pre>

<p>You need to, in association with sending line endings in your first program, read each character of a single line either into a string and then parse that as a float (with <code>dtostrf()</code>) or directly into a float using a state machine.</p>

<p>You can read more about working with serial <a href="https://hackingmajenkoblog.wordpress.com/2016/02/01/reading-serial-on-the-arduino/" rel="nofollow noreferrer">here</a> and working with a number reading state machine <a href="https://www.gammon.com.au/serial" rel="nofollow noreferrer">here</a>.</p>
