1

I was trying to display the readings of my dht11 sensor on the Blynk dashboard but I am struggling a lot. A little help would be really appreciated.

#define BLYNK_PRINT Serial/* Fill in information from Blynk Device Info here */#define BLYNK_TEMPLATE_ID "TMPL3cu_fjr1u"#define BLYNK_TEMPLATE_NAME "DHT11 Example"#define BLYNK_AUTH_TOKEN "bpPlBa8ehOqw0sJLKJeO1thMlulVXUCY"#include <DHT.h>#include <WiFi.h>#include <WiFiClient.h>#include <BlynkSimpleEsp32.h>// Your WiFi credentials.// Set password to "" for open networks.char ssid[] = "***";char pass[] = "***";#define DHTPIN 2          // What digital pin we're connected to// Uncomment whatever type you're using!#define DHTTYPE DHT11     // DHT 11DHT dht(DHTPIN, DHTTYPE);BlynkTimer timer;// This function sends Arduino's up time every second to Virtual Pin (5)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);  dht.begin();  // Setup a function to be called every second  timer.setInterval(1000L, sendSensor);}void loop(){  Blynk.run();  timer.run();}

When I run this, it gets uploaded with no error, but Blynk shows that the device is offline and this is shown in the serial monitor of Arduino IDE:

15:38:20.658 -> ELF file SHA256: 4b7072eae15:38:20.699 -> 15:38:20.735 -> Rebooting...15:38:20.735 -> �[5001] Connecting to 0.0.0.015:38:26.059 -> 15:38:26.092 -> assert failed: xQueueSemaphoreTake queue.c:1709 (( pxQueue ))15:38:26.181 -> 15:38:26.181 -> 15:38:26.181 -> Backtrace: (some lot of characters)15:38:26.512 -> 15:38:26.512 -> 15:38:26.545 -> 15:38:26.545 -> 15:38:26.545 -> ELF file SHA256: 4b7072eae15:38:26.578 -> 15:38:26.578 -> Rebooting...15:38:26.614 -> ��[5001] Connecting to 0.0.0.015:38:35.107 -> 15:38:35.140 -> assert failed: xQueueSemaphoreTake queue.c:1709 (( pxQueue ))15:38:35.206 -> 15:38:35.206 -> 15:38:35.206 -> Backtrace: (some lot of characters)15:38:35.590 -> 15:38:35.590 -> 15:38:35.590 -> 15:38:35.590 -> 15:38:35.626 -> ELF file SHA256: 4b7072eae15:38:35.626 -> 15:38:35.626 -> Rebooting...15:38:35.668 -> �

Please help

Rohit Gupta's user avatar
Rohit Gupta
6342 gold badges6 silver badges21 bronze badges
askedApr 8 at 10:17
KnightRiderDutt's user avatar
2
  • 1
    you don't have the necessary WiFi credentials to connect to your LANCommentedApr 8 at 19:20
  • 1
    @jsotola I do, I have removed them before posting the codeCommentedApr 9 at 6:22

2 Answers2

1

CallBlynk.begin(BLYNK_AUTH_TOKEN, ssid, pass) to establish a WiFi connection first.

SeeESP32_WiFi.ino example.

answeredApr 9 at 2:11
hcheung's user avatar
1

You're missing the Blynk.begin(auth, ssid, pass) call. Without it, Blynk never initializes properly, and that causes the queue/semaphore crash. The setup must look like this:

void setup(){  Serial.begin(9600);  delay(1000); // Give time to serial to initialize  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);  dht.begin();  timer.setInterval(1000L, sendSensor);}
answeredApr 24 at 16:22
tepalia's user avatar

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.