Hello everyone !
I recently purchased ESP32s. While wanting to test them before putting them into service, I realized that the void after the void loop does not launch. In my case the void “analogRead”. I don’t understand, certainly something stupid that I forgot. The same code works on my ESP8266.
At launch I have the return of connection of the ESP32 to the blynk server then nothing more.
if I put my void “analogRead” in the void loop it works.
Any ideas ?
Thank you
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
//
#define AOUT_PIN 34
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";
char ssid[] = "xx";
char pass[] = "xx";
SimpleTimer timer;
void setup() {
Serial.begin(115200);
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
int wifi_ctr = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected");
Blynk.begin(auth, ssid, pass, IPAddress(10, 3, 141, 1), 8080);
timer.setInterval(2000L, analogRead);
}
void loop(){
Blynk.run();
}
void analogRead()
{
int value = analogRead(AOUT_PIN); // read the analog value from sensor
Serial.print("Moisture value: ");
Serial.println(value);
delay(500);
}