Подскажите с подключением датчика температуры возникает ошибка постоянно
Код:
Arduino: 1.6.7 (Windows 10), Плата:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Serial, 115200, 4M (3M SPIFFS)"
C:\Users\1\Desktop\Arduino-master\libraries\Moy\Moy.ino: In function 'void setup()':
Moy:49: error: 'sut' was not declared in this scope
timer.setInterval(1000,sut);
^
C:\Users\1\Desktop\Arduino-master\libraries\Moy\Moy.ino: In function 'void loop()':
Moy:73: error: redefinition of 'void loop()'
void loop()
^
Moy:69: error: 'void loop()' previously defined here
void loop(){
^
exit status 1
'sut' was not declared in this scope
[HASHTAG]#define[/HASHTAG] BLYNK_PRINT Serial // Comment this out to disable prints and save space
[HASHTAG]#include[/HASHTAG] <SPI.h>
[HASHTAG]#include[/HASHTAG] <ESP8266WiFi.h>
[HASHTAG]#include[/HASHTAG] <BlynkSimpleEsp8266.h>
[HASHTAG]#include[/HASHTAG] <SimpleTimer.h>
[HASHTAG]#include[/HASHTAG] "DHT.h"
[HASHTAG]#define[/HASHTAG] DHTTYPE DHT21 // DHT 21 (AM2301)
[HASHTAG]#define[/HASHTAG] DHTPIN 12 // pin dht
DHT dht(DHTPIN, DHTTYPE, 15);
SimpleTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "7ab4ae12885f46b5940c82ee2d53";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, "TP", "00001111");
Blynk.connect();
pinMode(12, INPUT); // 12 - dht
digitalWrite(12, 1);
timer.setInterval(1000,sut);
dht.begin();
}
void setup()
{
int t = dht.readTemperature();
int h =dht.readHumidity();
// Проверка удачно прошло ли считывание.
if (isnan(h) || isnan(t)) {
Serial.println("Non DHT values");
return;
}
Blynk.virtualWrite(1, t);
Serial.print(t);
Serial.print("C ");
Blynk.virtualWrite(2,h);
Serial.print(h);
Serial.print("%");
}
void loop(){
Blynk.run();
timer.run();
}
void loop()
{
Blynk.run();
}
[HASHTAG]#include[/HASHTAG] <SPI.h>
[HASHTAG]#include[/HASHTAG] <ESP8266WiFi.h>
[HASHTAG]#include[/HASHTAG] <BlynkSimpleEsp8266.h>
[HASHTAG]#include[/HASHTAG] <SimpleTimer.h>
[HASHTAG]#include[/HASHTAG] "DHT.h"
[HASHTAG]#define[/HASHTAG] DHTTYPE DHT21 // DHT 21 (AM2301)
[HASHTAG]#define[/HASHTAG] DHTPIN 12 // pin dht
DHT dht(DHTPIN, DHTTYPE, 15);
SimpleTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "7ab4ae12885f46b5940c82ee2d53";
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, "TP", "00001111");
Blynk.connect();
pinMode(12, INPUT); // 12 - dht
digitalWrite(12, 1);
timer.setInterval(1000,sut);
dht.begin();
}
void setup()
{
int t = dht.readTemperature();
int h =dht.readHumidity();
// Проверка удачно прошло ли считывание.
if (isnan(h) || isnan(t)) {
Serial.println("Non DHT values");
return;
}
Blynk.virtualWrite(1, t);
Serial.print(t);
Serial.print("C ");
Blynk.virtualWrite(2,h);
Serial.print(h);
Serial.print("%");
}
void loop(){
Blynk.run();
timer.run();
}
void loop()
{
Blynk.run();
}
Последнее редактирование: