본문 바로가기
임베디드/Arduino

blynk dht11

by sj0020 2020. 9. 16.

 

/*************************************************************
  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

 

[Blynk] 온습도 데이터 확인 어플 만들기 (NodeMCU)

○ 프로젝트 소개 온 습도센서 데이터를 SuperChart로 화면에 출력하기를 해보도록 하겠습니다. 아마 가장 확장이 넓게 가능할 것으로 보이는데요? 온습도 데이터를 실시간으로 확인이 필요한

kgu0724.tistory.com

 

 

'임베디드 > 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