Why there are error for DHT 11?

hi again
i use DHT 11 example for blynk. but i have error
like this-

invalid conversion from ‘char*’ to ‘uint16_t {aka short unsigned int}’ [-fpermissive]

and this is my code

#define BLYNK_PRINT Serial


#include <SPI.h>

#include <BlynkSimpleEthernet.h>
#include <DHT.h>

#include <ESP8266WiFi.h>

DHT dht(2, DHT11);
BlynkTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "...";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "KT_WLAN_E514_5GHz";
char pass[] = "0000004147";
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(9600);

  Blynk.begin(auth, ssid, pass);
  dht.begin();

}

void loop()
{
  Blynk.run();
  timer.run();
}

how can i solve this error TT

You have a number of issues…

  1. You haven’t formatted your code correctly when you posted it on the forum
  2. You haven’t stated what hardware and connection method you’re using
  3. You’ve mixed Wi-Fi and wired Ethernet libraries in your code:

You should be using:

#include <BlynkSimpleEsp8266.h>

instead of the BlynkSimpleEthernet library

  1. It looks like you’re trying to connect to a 5GHz Wi-Fi network with a device that only supports 2.4GHz:
  1. You’ve shared your Auth Code on a public forum :open_mouth::
  1. You’ve structured your code so that the function that reads the DLT sensor will never be called. You’ve omitted to add a timer in Void Setup that calls void sendSensor(). When you correct this, take care not to call the function more often than every 5000 milliseconds, because…
  2. You’ve chosen to use the worst temperature sensor there is!

Other than that, you’re doing okay :grin:

Pete.

2 Likes

Thank you for your comment that error is gone but i got another error:joy:, my hardware is arduino uno and esp8266 module for wifi. i just used dht 11 for exercise example by blynk…:sweat_smile:
i tried that code without dht 11 but it didn’t work too :disappointed_relieved:
i succed comfile and upload but my blynk app say “device is offline” and serialmonitor said “there are no shield”
then i think i need wifi shield instead of esp8266 module or example for esp8266module with arduino uno.
i think esp8266 shield and module is different thing but i have example just for shield with uno one…

I’ve never been crazy enough to try using an ESP{8266 as a Wi-Fi adapter for an Arduino, but it’s certainly possible and probably more reliable/flexible some of the dedicated Wi-Fi shields.
You need to choose the correct hardware combination in the Sketch Builder, and read this guide:
http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/arduino/esp8266-with-at-firmware

It’s really important to use the correct baud rate to connect the ESP to the UNO (9600 baud) and you need to ensyre that the ESP is set to the same baud rate using an AT command.

Unless you really need to use the Arduino, you’d be better throwing it away and using an ESP8266 based NodeMCU type board such as the Wemos D1 Mini. These can be programmed directly using the Arduino IDE (once you’ve installed the ESP8266 core) and are faster and have significantly more memory than the Arduino Uno - and of course they connect directly to Wi-Fi as a self contained device. They’re also considerably cheaper than an Uno.

Pete.

1 Like

wow… ok then i think it is better to change the module esp8266 to ethernet shield.
this is my capstone design class project. i’m student so my professor suggest us arduino uno ( i think he is devil…) and we don’t know esp8266 is hard for wifi that much ( i think seller of module is devil!!! he said it’s so simple to connect wifi :joy:) but my project dead line is next week and i don’t have money and time enough :grin:
thank you for revealing that huuuuuge truth!

If you have an Ethernet shield that you can use with the Uno then that might be easier to get working, although they can be quite unreliable and sometimes don’t like to be used with certain types of Ethernet switches.
Some students have been caught-out when they get the hardware working at home then find it wont work on the school network because the Ethernet shield doesn’t like the switches being used.

Your professor’s knowledge is probably a few years out of date when it comes to the best type of board to use for projects like this.

Pete.

1 Like

yeah he’s role in our class is just check our state and little advice :sunglasses:
and i think i can borrow my friend’s shield (ethernet, wifi whatever) whose project is end already.
and thank you for your advice! see ya!

Check this post maybe will help you a bit… or not :rofl:

1 Like