cannot connect between HC-06 and LM35 Temperature Sensor

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);

int sensorPin = 0;
float voltage;

void setup()
{
Serial.begin(9600);

}

void loop()
{

int reading = analogRead(sensorPin);

float voltage = reading * 1.0;
voltage /= 100.0;

float temperatureC = (voltage - 0.5) * 100 ;

Serial.print(temperatureC); Serial.println(" degrees C");

delay(5000); //waiting a second
}

if (Serial.available())
{
delay(1000);
mySerial.write(Serial.read());
}

I have been try this coding to get a temperature reading from temperature and its work. But when I connect it to the bluetooth and want to send the temperature reading to android application it does not work. Can somebody give me a guide how to make the bluetooth get the data from sensor and send it to my application

It would be soooo nice if people would read how to use the forum before posting and use code tags (the # button) to make code easy to read.

mzh_s:

 Serial.print(temperatureC); Serial.println(" degrees C");

mySerial.write(Serial.read());





I have been try this coding to get a temperature reading from temperature and its work. But when I connect it to the bluetooth and want to send the temperature reading to android application it does not work.

I have deleted all but a couple of lines of code just to keep things shorter.

I'm guessing that the first line displays the values on the Serial Monitor (and the rest of my comments are based on that assumption).

But I have no idea why you think the second line might do anything at all. It looks as if you imagine that the data that was sent to the Serial monitor can be got back with Serial.read() - it can't. Everything you send to the Serial monitor is gone forever.

However the data is still in your Arduino in the variables where you put it.

So the SIMPLE way to send the data is to have the second line nearly the same as the first but using mySerial in place of Serial

mySerial.print(temperatureC); 
mySerial.println(" degrees C");

And it is much easier to figure out code if every statement is on a separate line.

...R

Whenever I rent a car... I get in, adjust the mirrors, turn the key and go. Who pulls out the owner's manual first?

Robin2:
It would be soooo nice if people would read how to use the forum before posting and use code tags (the # button) to make code easy to read.

Since soooo many people make that 'error' one starts to wonder if the method of communicating the 'requirements' are effective, or are they tucked away in the glove box? :blush:

Since soooo many people make that 'error' one starts to wonder if the method of communicating the 'requirements' are effective, or are they tucked away in the glove box?

There's been a lot of discussion on the moderator forum about requiring people to pass some kind of IQ test before they can post. Something simple, to prove that they've read the user manual, for instance.

At first, I thought that such a thing was not really necessary, other than to avoid spammers. Now, I'm sure that something like an IQ test to weed out people that won't (not can't) read two simple posts would eliminate an awful lot of crap in this forum.

Simple Machines may want to add a way of adding some kind of informational checklist for your first 3-5 posts, in addition to the captchas.

before you confirm your post...

did you place your code in code tags?
did you include your complete code (if you can)?
did you send PaulS US$10 by PayPal?

(just examples... :blush:)

that should bring the threshold IQ up to about 70

of course... the Moderators could always just ignore the lack of code tags and see if the universe spins off its wheels. Let the bits fall where they may kind-of-thing...

BulldogLowell:
of course... the Moderators could always just ignore the lack of code tags and see if the universe spins off its wheels. Let the bits fall where they may kind-of-thing...

I dare say it makes life easier for you as much as for anyone else when the code is properly presented.

And I'm sure you take a bit of trouble to be nice to someone when you ask them a favour.

...R

. the Moderators could always just ignore the lack of code tags and see if the universe spins off its wheels

This particular reluctant moderator mostly does ignore lack of code tags, until the poster uses 'i' as an index . . .
(Or 'b', 's', 'u' . . . you get my drift)

And then I go ape-sh*t.