|
@@ -41,7 +41,7 @@ void setup() {
|
|
|
|
|
|
void loop() {
|
|
|
//Si autospegne se non riceve alcun messaggio per un ora
|
|
|
- if (contatoreSecondi > 3600){
|
|
|
+ if (contatoreSecondi > 7200){
|
|
|
stopCaldaia();
|
|
|
blueToothVal=' ';
|
|
|
|
|
@@ -53,33 +53,7 @@ void loop() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (blueToothVal=='0')//se ricevo 0 lo spengo
|
|
|
- {
|
|
|
- stopCaldaia();
|
|
|
- mySerial.write('0\n');
|
|
|
- blueToothVal=' ';
|
|
|
- contatoreSecondi = 0;
|
|
|
- }
|
|
|
- else if (blueToothVal=='1') //se ricevo 1 lo accendo
|
|
|
- {
|
|
|
- startCaldaia();
|
|
|
- mySerial.write('1\n');
|
|
|
- blueToothVal=' ';
|
|
|
- contatoreSecondi = 0;
|
|
|
- }
|
|
|
- else if(blueToothVal=='s'){ //richiedo lo stato e azzero il contatore
|
|
|
- mySerial.write(statoRele); //mando lo stato
|
|
|
- mySerial.write("\n");
|
|
|
- blueToothVal=' ';
|
|
|
- contatoreSecondi = 0;
|
|
|
- }
|
|
|
- else if(blueToothVal=='t'){ //info sul contatore
|
|
|
- String myString = String(contatoreSecondi);
|
|
|
- char charBuf[50];
|
|
|
- myString.toCharArray(charBuf, 50);
|
|
|
- strcat(charBuf, "\n");
|
|
|
- mySerial.write(charBuf); //mando lo stato
|
|
|
- }
|
|
|
+ String stringContatore;
|
|
|
|
|
|
switch (blueToothVal) {
|
|
|
case '0'://se ricevo 0 lo spengo
|
|
@@ -100,7 +74,13 @@ void loop() {
|
|
|
blueToothVal=' ';
|
|
|
contatoreSecondi = 0;
|
|
|
break;
|
|
|
-
|
|
|
+ case 't'://info sul contatore
|
|
|
+ stringContatore = String(contatoreSecondi);
|
|
|
+ char charBuf[50];
|
|
|
+ stringContatore.toCharArray(charBuf, 50);
|
|
|
+ strcat(charBuf, "\n");
|
|
|
+ mySerial.write(charBuf); //mando lo stato
|
|
|
+ break;
|
|
|
default:
|
|
|
// if nothing else matches, do the default
|
|
|
// default is optional
|