/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example runs directly on ESP8266 chip.
Note: This requires ESP8266 support package:
https://github.com/esp8266/Arduino
Please be sure to select the right ESP8266 module
in the Tools -> Board menu!
Change WiFi ssid, pass, and Blynk auth token to run :)
Feel free to apply it to any other example. It's simple!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTTYPE DHT11
#define DHTPIN 13 // 몇번에 연결했는지 .. 바꿔줘야함. D7에 꽂아서 13
DHT dht(DHTPIN, DHTTYPE);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "************; // 이메일로 받은 auth code 입력
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "***"; // 와파 이름
char pass[] = "****5"; //와파 비번
void setup()
{
// Debug console
Serial.begin(115200);
dht.begin();
Blynk.begin(auth, ssid, pass);
}
void sendValue(){
float h = dht.readHumidity();
float t = dht.readTemperature();
if ( isnan(h) || isnan(t) ) {
Serial.println("Failed to load DHT Sensor Data");
delay(1000);
return;
}
Blynk.virtualWrite(V0, h); //폰에서 세팅 V0 으로 바꿔줘야함
Blynk.virtualWrite(V1, t); //폰에서 세팅 V1
}
void loop()
{
Blynk.run();
sendValue();
}
아래 블로그 그대로 코드 복붙하면 안되고 수정해야됨 .. V5 V6 아니고 V0 V1
https://kgu0724.tistory.com/147
'임베디드 > Arduino' 카테고리의 다른 글
RGB LED 랜덤함수 (0) | 2020.09.18 |
---|---|
JMOD-BT-01 블루투스 모듈 / dht11 / MIT App Inventor (0) | 2020.09.16 |
esp8266 blynk (0) | 2020.09.16 |
아두이노 복습..하는...날 . ........... (0) | 2020.09.15 |
arduino pin map (0) | 2020.09.15 |