Hi, I’m Davide Minervini and I’ve just started programming, so I’m inexperienced.
While I was trying to program an esp 32 board and Blynk software via wireless communication I ran into a problem.
My goal is to get the reading value of the photoresistor (pin 2) every second both on the serial monitor and on my dashboard with a gauge with pin V3 of my Android phone.
The problem I encountered with the following sketch is that both the application gauge and the serial monitor respond to me with a value of 0. Testing the sensor with another basic sketch, they respond to me correctly.
I hope you can help me, I await your answers.
Thank you in advance for your cooperation.
BlynkTimer timer;
int foto = 2;
int val;
void setup() {
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
Serial.begin(9600);
pinMode(foto, INPUT);
}
void loop() {
val = analogRead(foto);
Blynk.virtualWrite(V3, val);
Serial.print("sensor = ");
Serial.println(val); //stampa valore
delay(1000);
Blynk.run();
}
BLYNK_CONNECTED(){
Blynk.syncVirtual(V3);
}