|
1. 프로젝트 사용한 보드 종류
lolin d32보드에 esp32칩
2. 사용한 개발 프로그램명
아두이노 ide 1.8.12
3. 사용한 센서 모델명
dht11
4. 연결한 회로 설명 (또는 이미지)
5. 소스코드 (주석 필수)
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "kIdvvMLazBXFdtd9mcKyUaCB90X5Hkb4";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "405";
char pass[] = "Dlrmsals12@";
#define DHTPIN 33 // What digital pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
}
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
dht.begin();
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}
6. 문제점 및 에러 내용
blynk를 통해서 온습도 데이터를 받기 위해 인터넷에 있는 예제와 blynk 라이브러리에 있는 dht11예제를 실행해봤는데 둘다 '보드 LOLIN D32 컴파일 에러' 라는 오류가 뜨면서 컴파일이 되지 않습니다.
esp32_wifi 예제를 통한 스마트폰과의 연결은 잘 되구요 인터넷 연결이 아닌 dht11예제로 dht11이 작동 되는 것은 확인하였습니다.
아무것도 모르는 생 초보라 뭐가 틀렸는지 모르겠네요..
|