Hello everybody
I have a problem that doesn't let me go on with programming because it gives me a stupid problem but it really makes me angry. The "Positive" does not read me.
I can already tell you that I have installed all the possible libraries and nothing works. I tried to write the code in other ways, but nothing !!!!!
Help me please
Here is the program code for those interested:
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int retro = 5;
int verdefisso = 8;
int verdelampe = 10;
int rossofisso = 9;
int rossolampe = 11;
int rele = 13;
#define wirebus1 12
OneWire onewire1(wirebus1);
DallasTemperature sonda1(&onewire1);
#define wirebus2 2
OneWire onewire2(wirebus2);
DallasTemperature sonda2(&onewire2);
int pulsante = 3;
int sda = A4;
int scl = A5;
float celsius1=0;
float celsius2=0;
int buz = 4;
void setup() {
Serial.begin(9600);
lcd.begin(20,4);
sonda1.begin();
sonda2.begin();
pinMode(retro, OUTPUT);
analogWrite(retro, 150); //da 0 a 255
pinMode(verdefisso, OUTPUT);
pinMode(verdelampe, OUTPUT);
pinMode(rossofisso, OUTPUT);
pinMode(rossolampe, OUTPUT);
pinMode(rele, OUTPUT);
pinMode(pulsante, INPUT);
pinMode(buz, OUTPUT);
} void loop() {
sonda1.requestTemperatures();
celsius1=sonda1.getTempCByIndex(0);
sonda2.requestTemperatures();
celsius2=sonda2.getTempCByIndex(0);
int val=digitalRead(pulsante);
if(val==1){
digitalWrite(rele, HIGH); //spento
//lcd.setCursor(3,0);
// lcd.print("Digita sul");
digitalWrite(buz, HIGH);
digitalWrite(verdefisso, HIGH);
digitalWrite(verdelampe, HIGH);
digitalWrite(rossofisso, HIGH);
digitalWrite(rossolampe, HIGH);
Serial.print("Sonda 1: ");
Serial.println(celsius1);
Serial.println("Sonda 2: ");
Serial.println(celsius2);
delay(1000);
//lcd.setCursor(1,0);
//lcd.print("Digita sul");
digitalWrite(rele, LOW);
digitalWrite(buz, LOW);
digitalWrite(verdefisso, LOW);
digitalWrite(verdelampe, LOW);
digitalWrite(rossofisso, LOW);
digitalWrite(rossolampe, LOW);
delay(1000);
}else{
digitalWrite(verdefisso, HIGH);
digitalWrite(verdelampe, HIGH);
digitalWrite(rossofisso, HIGH);
digitalWrite(rossolampe, HIGH);
}
}