[SOLVED] Button in the app blynk not trigger Arduino output

I was using the example of “Arduino ethernet” and the buttons on blynk app usually They used the outputs of the Arduino. then I added some instructions for using the dht11 sensor, the buttons do not work anymore.
Anyone know how I can fix this?

My cod is this:

#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include < SPI.h>
#include < Ethernet.h>
#include < BlynkSimpleEthernet.h>
#include < dht.h>
#define dht_dpin A0 //Pino DATA do Sensor ligado na porta Analogica A1
dht DHT; //Inicializa o sensor

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

void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
Blynk.run();
// You can also specify server.
// For more options, see BoardsAndShields/Arduino_Ethernet_Manual example
//Blynk.begin(auth, “your_server.com”, 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8888);
}

void loop()
{
Blynk.run();
{
DHT.read11(dht_dpin); //Lê as informações do sensor
float t = DHT.temperature;
char buf[5];
dtostrf(t, 3,0, buf);
Blynk.virtualWrite(V1, String(buf) + “℃”);

{

float h = DHT.humidity;
char buf[5];
dtostrf(h, 3,0, buf);
Blynk.virtualWrite(V2, String(buf) + “%”);

delay(1000);
}
}
}

Hello.

  1. Remove Blynk.run() from setup().
  2. Add
while (Blynk.connect() == false) {
      // Wait until connected
}

After Blynk.begin(auth);
3. Remove delay from loop and replace with timer. Please go through examples we provided.

would look like?

#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include < SPI.h>
#include < Ethernet.h>
#include < BlynkSimpleEthernet.h>
#include < dht.h>
#include < SimpleTimer.h>
#define dht_dpin A0 //Pino DATA do Sensor ligado na porta Analogica A1
dht DHT; //Inicializa o sensor

SimpleTimer timer;

char auth[] = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;

void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
Blynk.run();
}

void loop()
{

while(Blynk.connect() == false)
// Aguarde até conectado

Blynk.begin(auth);
{
DHT.read11(dht_dpin); //Lê as informações do sensor
float t = DHT.temperature;
char buf[5];
dtostrf(t, 3,0, buf);
Blynk.virtualWrite(V1, String(buf) + “℃”);
{

float h = DHT.humidity;
char buf[5];
dtostrf(h, 3,0, buf);
Blynk.virtualWrite(V2, String(buf) + “%”);

timer.run();
}
}
}

Here is basic example.

solved: thank you.
the encoded stayed that way.

#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include < SPI.h>
#include < Ethernet.h>
#include < BlynkSimpleEthernet.h>
#include < dht.h>
#include < SimpleTimer.h>
#define dht_dpin A0 //Pino DATA do Sensor ligado na porta Analogica A1
dht DHT; //Inicializa o sensor

SimpleTimer timer;

char auth[] = “8f1d27f9786941b08b69b9a2ca89f627”;

void setup()
{
Serial.begin(9600);
while(Blynk.connect() == false)
Blynk.begin(auth);
timer.setInterval(1000L, sendUptime);
}

void sendUptime()

{
DHT.read11(dht_dpin); //Lê as informações do sensor
float t = DHT.temperature;
char buf[5];
dtostrf(t, 3,0, buf);
Blynk.virtualWrite(V1, String(buf) + “℃”);
{

float h = DHT.humidity;
char buf[5];
dtostrf(h, 3,0, buf);
Blynk.virtualWrite(V2, String(buf) + “%”);

}
}

void loop()

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

Please edit your posts. Code should be formatted.

How to do that:

 ```cpp <--- insert this //cpp means c++
 Paste your code here
 ``` <--- insert this 

This makes your code beautiful with highlighted syntax, like this:

void helloWorld() 
{ 
   String message =  "hello" + "world"; 
}