Hello Community.
I hava a Problem.
I want to send the Data from a DHT22 to Blynk over a ESP8266-01.
The connection is working and the reading of the DHT22 too.
But when i open Blynk on my Android there are not the Data from the DHT22.
/**************************************************************
* 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
* Social networks: 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 shows how to use ESP8266 Shield (with AT commands)
* to connect your project to Blynk.
*
* WARNING!
* It's rather tricky to get it working, please read this article:
* https://github.com/blynkkk/blynk-library/wiki/ESP8266-with-AT-firmware
*
* Change WiFi ssid, pass, and Blynk auth token to run :)
* Feel free to apply it to any other example. It's simple!
*
**************************************************************/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <DHT.h>
#include <SimpleTimer.h>
#define DHT1PIN 53 //Pinbelegung DHT1
#define DHT1TYPE DHT22
// Instantiates and initializes the dht object
DHT dht1(DHT1PIN, DHT1TYPE); //Initialisieren DHT1
SimpleTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXXXXXX";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXXXXXXX";
char pass[] = "XXXXXXXX";
// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1
// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
void sendSensor()
{
float h1 = dht1.readHumidity();
float t1 = dht1.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h1) || isnan(t1)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.println("Temperature: "+String(t1));
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V1, h1);
Blynk.virtualWrite(V2, t1);
}
void setup()
{
// Set console baud rate
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
dht1.begin();
timer.setInterval(10000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}
Here is the Serial Print.
[19]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
///_, /////_
/__/ v0.4.6 on Arduino Mega
[604] Connecting to UPC246454487
[3639] AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(656edbf)
compile time:Jul 19 2016 18:44:44
OK
[4702] Failed to enable MUX
[9734] +CIFSR:STAIP,“192.168.192.3”
+CIFSR:STAMAC,“5c:cf:7f:a5:5e:80”
[9742] Connected to WiFi
[19902] Ready (ping: 11ms).
Temperature: 19.50
Temperature: 19.50
What is wrong? Do i have a problem in my Code?
Thank you.