|
@@ -10,7 +10,7 @@ String val = "";
|
|
|
double Temperature;
|
|
|
|
|
|
//parte bluetooth
|
|
|
-SoftwareSerial mySerial(52, 53); // RX, TX
|
|
|
+SoftwareSerial blueToothSerial(52, 53); // RX, TX
|
|
|
String command = ""; // Stores response of the HC-06 Bluetooth device
|
|
|
char blueToothVal; //value sent over via bluetooth
|
|
|
char lastValue; //stores last state of device (on/off)
|
|
@@ -64,7 +64,7 @@ void setup() {
|
|
|
Serial.println("Type AT commands!");
|
|
|
|
|
|
// The HC-06 defaults to 9600 according to the datasheet.
|
|
|
- mySerial.begin(9600);
|
|
|
+ blueToothSerial.begin(9600);
|
|
|
pinMode(13,OUTPUT);
|
|
|
|
|
|
Temperature = Thermister(analogRead(0));
|
|
@@ -116,24 +116,24 @@ void loop() {
|
|
|
|
|
|
|
|
|
// Read user input if available.
|
|
|
- if (mySerial.available()){
|
|
|
+ if (blueToothSerial.available()){
|
|
|
//delay(10); // The delay is necessary to get this working!
|
|
|
- //mySerial.write(Serial.read());
|
|
|
- blueToothVal=(char)mySerial.read(); //read it
|
|
|
+ //blueToothSerial.write(Serial.read());
|
|
|
+ blueToothVal=(char)blueToothSerial.read(); //read it
|
|
|
Serial.println("sono dentro");
|
|
|
}
|
|
|
if (blueToothVal=='n')
|
|
|
{//if value from bluetooth serial is n
|
|
|
digitalWrite(13,HIGH); //switch on LED
|
|
|
|
|
|
- mySerial.write(NormalizedTemp(Temperature));
|
|
|
+ blueToothSerial.write(NormalizedTemp(Temperature));
|
|
|
blueToothVal=' ';
|
|
|
}
|
|
|
else if (blueToothVal=='f')
|
|
|
{//if value from bluetooth serial is n
|
|
|
digitalWrite(13,LOW); //turn off LED
|
|
|
|
|
|
- mySerial.write(NormalizedTemp(Temperature));
|
|
|
+ blueToothSerial.write(NormalizedTemp(Temperature));
|
|
|
blueToothVal=' ';
|
|
|
}
|
|
|
delay(1000);
|