Need help With My Blynk installation and code

I have install Blynk but there isn a digital pinout options for LED on ESP32 module. Only virtual!!
On the tutorial there was a digital pinout!


Help please!
Thanks

I think you have used the wrong widget.
You’ve used an LED widget(http://docs.blynk.cc/#widgets-displays-led). Virtual pins only.
You should have used a BUTTON widget(http://docs.blynk.cc/#widgets-controllers-button). Virtual and Digital pins.

Perhaps the OP is referring to what pin options are on the App for the ESP32?

@Sosa Make sure you have the latest App and are choosing the correct device…

But yes… if choosing the LED Widget… well :stuck_out_tongue: opps

Embarrassingly, I have to admit the first thing I tried with these new ESP32’s was this very project, turn the onboard LED on and off. In my haste I selected the LED widget instead of a button. I was extremely confused for about 20 minutes until I realised what I’d done, then I laughed at myself.

In case the inverted LED issue bugs you, like it does me, just set the button MIN/MAX up as 1-0 instead of 0-1

1 Like

It does, thank you! :star_struck:

Thanks. My blynk says that my aplikation wasnt online yet!

Solved . Thanks very much.

And the solution was?

image

1 Like

Hi i am new in this, so I must ask for help.
I have DHT12 sensor on ESP Wroom32, and it is work fine, but when I try to conect with Blynk doesnt work. I do not understand why!
I can not make Blynk project to control and show temp. and humidity.

Thanks

Here is the code:

#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Blynk.h>
#include <WiFi.h>
const char* ssid = "xxx";
const char* password =  "xxx";
char auth[] = "xxxxx";


#include "Arduino.h"
#include <DHT12.h>

// Set dht12 i2c comunication on default Wire pin
  DHT12 dht12;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.println("Connecting to WiFi..");
}
 Serial.println("Connected to the WiFi network");
 Serial.println(WiFi.localIP());
 Blynk.begin("a390a92761eb4e5c941e8b1741d071b3", ssid, password);
 dht12.begin();
}


int timeSinceLastRead = 0;
void loop() {
   Blynk.run();
  // put your main code here, to run repeatedly:
  if(timeSinceLastRead > 2000) {
// Reading temperature or humidity takes about 250 milliseconds!
// Read temperature as Celsius (the default)
float t12 = dht12.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f12 = dht12.readTemperature(true);
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h12 = dht12.readHumidity();
 
bool dht12Read = true;
// Check if any reads failed and exit early (to try again).
if (isnan(h12) || isnan(t12) || isnan(f12)) {
Serial.println("Failed to read from DHT12 sensor!");
 
dht12Read = false;
}
 
if (dht12Read){
// Compute heat index in Fahrenheit (the default)
float hif12 = dht12.computeHeatIndex(f12, h12);
// Compute heat index in Celsius (isFahreheit = false)
float hic12 = dht12.computeHeatIndex(t12, h12, false);
// Compute dew point in Fahrenheit (the default)
float dpf12 = dht12.dewPoint(f12, h12);
// Compute dew point in Celsius (isFahreheit = false)
float dpc12 = dht12.dewPoint(t12, h12, false);
 
Serial.print("DHT12=> Humidity: ");
Serial.print(h12);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t12);
Serial.print(" *C ");
Serial.print(f12);
Serial.print(" *F\t");
Serial.print(" Heat index: ");
Serial.print(hic12);
Serial.print(" *C ");
Serial.print(hif12);
Serial.print(" *F");
Serial.print(" Dew point: ");
Serial.print(dpc12);
Serial.print(" *C ");
Serial.print(dpf12);
Serial.println(" *F");
}
timeSinceLastRead = 0;
}
delay(100);
timeSinceLastRead += 100;
 
}

And of course your post for me.

Thanks very much.

Well, it looks like the final solution isn’t complete yet… no need for a separate topic, so I moved your post back here.

Also, I fixed your formatting of the code you posted here, as per the directions…

Blynk - FTFC

As for your issue of getting your code to work… it is not well written for Blynk. You have too much in the void loop()

Read through the Help Center for more information…

You are the best . Thanks very much again.:grinning:

I ll try .

@Sosa The DHT12 is downward compatible with the DHT11, this worked for me on my DHT11 so give it a try …

/**************************************************************
   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
     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 value can be pushed from Arduino to
   the Blynk App.

   WARNING :
   For this example you'll need SimpleTimer library:
     https://github.com/jfturcot/SimpleTimer
   and Adafruit DHT sensor library:
     https://github.com/adafruit/DHT-sensor-library

   App project setup:
     Value Display widget attached to V5
     Value Display widget attached to V6

 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <BlynkSimpleEsp32.h>
#include <SimpleTimer.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxx";
char pass[] = "xxxxxxxx";

#define DHTPIN 2          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
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()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, ssid, pass);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}

I cant doasent work. how can I conect the DHT12 with ESP32 like DHT 11?

Only this code work without Blynk!

#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#include <DHT12.h>
#include <Blynk.h>
#include "Arduino.h"
#define DHTYPE DHT12

// 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[] ="";
char pass[] = "";

DHT12 dht12;        // What digital pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301


BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h12 = dht12.readHumidity();
  float t12 = dht12.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h12) || isnan(t12)) {
    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, h12);
  Blynk.virtualWrite(V6, t12);
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin("", ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);

  dht12.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}
int timeSinceLastRead = 0;
void loop()
{
  Blynk.run();
  timer.run();
  float t12 = dht12.readTemperature();
  float h12 = dht12.readHumidity();
  bool dht12Read = true;
Serial.print("DHT12=> Humidity: ");
Serial.print(h12);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t12);
Serial.print(" *C ");
Serial.print("/n");
timeSinceLastRead = 0;
delay(1000);
timeSinceLastRead += 100;

}