I'm trying to make a project where something gets written down on the LCD when the threshold temperature is met, my issue is that I get this error.
C:\Users\Marin\Documents\Arduino\RELEJ_TEMP_VENT_-AUTOMATIKA\RELEJ_TEMP_VENT-_AUTOMATIKA.ino: In function 'void setup()':
RELEJ_TEMP_VENT_-_AUTOMATIKA:20: error: 'dht' was not declared in this scope
dht.begin();
^
C:\Users\Marin\Documents\Arduino\RELEJ_TEMP_VENT_-AUTOMATIKA\RELEJ_TEMP_VENT-_AUTOMATIKA.ino: In function 'void loop()':
RELEJ_TEMP_VENT_-_AUTOMATIKA:30: error: 't' was not declared in this scope
lcd.print(t);
^
RELEJ_TEMP_VENT_-_AUTOMATIKA:53: error: 'plus' was not declared in this scope
if (t = plus) {
^
exit status 1
'dht' was not declared in this scope
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 12
#define DHTTYPE DHT11
#include <Wire.h>// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int buttonPin2 = 3;LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
// variables will change:
int buttonState = 0; // variable for reading the pushbutton statusvoid setup() {
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
pinMode(buttonPin2, INPUT);
lcd.begin(16,2);
dht.begin();
}
static int stock = 20;
void loop() {// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);lcd.print("Temperatura: ");
lcd.print(t);
lcd.print("C");// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
int t = dht.readTemperature();
if (buttonState == HIGH) {
delay(250);
int plus = ++stock;
lcd.setCursor(0, 1);
lcd.print("On temp: ");
lcd.print(plus);
}
buttonState = digitalRead(buttonPin2);if (buttonState == HIGH) {
delay(250);
int plus = --stock;
lcd.setCursor(0, 0);
lcd.print("Number: ");
lcd.print(plus);
}if (t = plus) {
lcd.setCursor(0,1);
lcd.print("VENT. SPINS");
}}
Thanks in advance!!