BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk to thingspeak using webhook

Hello I need help on my project
I already read a few discussion but there is something that i cant understand
Why the value i get are not same as in my serial monitor

hope for fast response thanks

this is my coding

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = “jO6eiUFb7TYwBGjUEp5YmYMc3FRolDP7”;
char ssid[] = “nino_ai”;
char pass[] = “faris2210”;

int redLed = 5;
int yellowLed = 17;
int greenLed = 16;

int gas1 = 33;
int gas2 = 32;
int gas3 = 35;
int gas4 = 34;

int analogSensor1 = 0;
int analogSensor2 = 0;
int analogSensor3 = 0;
int analogSensor4 = 0;
BlynkTimer timer;

void setup()
{
pinMode(redLed, OUTPUT);
pinMode(yellowLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(gas1, INPUT);
pinMode(gas2, INPUT);
pinMode(gas3, INPUT);
pinMode(gas4, INPUT);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);

digitalWrite(redLed, 0);
digitalWrite(yellowLed, 0);
digitalWrite(greenLed, 0);
timer.setInterval(1000L, myTimerEvent);
timer.setInterval(5000L, SendToThingspeak);
}

void myTimerEvent()
{
Blynk.virtualWrite(V1, analogSensor1);
Blynk.virtualWrite(V2, analogSensor2);
Blynk.virtualWrite(V3, analogSensor3);
Blynk.virtualWrite(V4, analogSensor4);
}

void loop()
{
Blynk.run();
timer.run();
analogSensor1 = analogRead(gas1);
analogSensor2 = analogRead(gas2);
analogSensor3 = analogRead(gas3);
analogSensor4 = analogRead(gas4);

Serial.print("Sensor 1: ");
Serial.println(analogSensor1);
Serial.print("Sensor 2: ");
Serial.println(analogSensor2);
Serial.print("Sensor 3: ");
Serial.println(analogSensor3);
Serial.print("Sensor 4: ");
Serial.println(analogSensor4);
Serial.println();
delay(100);

if ((analogSensor1 > 100 && analogSensor1 < 500) && (analogSensor2 > 100 && analogSensor2 < 500) && (analogSensor3 > 100 && analogSensor3 < 500) && (analogSensor4 > 100 && analogSensor4 < 500))
{
digitalWrite(redLed, 0);
digitalWrite(yellowLed, 0);
digitalWrite(greenLed, 1);
}

else if ((analogSensor1 > 500 && analogSensor1 < 1500) && (analogSensor2 > 100 && analogSensor2 < 500) && (analogSensor3 > 100 && analogSensor3 < 500) && (analogSensor4 > 100 && analogSensor4 < 500))
{
digitalWrite(redLed, 0);
digitalWrite(yellowLed, 1);
digitalWrite(greenLed, 0);
}

else if ((analogSensor1 > 1500 && analogSensor1 < 3000) && (analogSensor2 > 100 && analogSensor2 < 500) && (analogSensor3 > 100 && analogSensor3 < 500) && (analogSensor4 > 100 && analogSensor4 < 500))
{
digitalWrite(redLed, 1);
digitalWrite(yellowLed, 0);
digitalWrite(greenLed, 0);
}
}

void SendToThingspeak()
{
Blynk.virtualWrite(V0, gas1, gas2, gas3, gas4);
}

Please edit your post to add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Also, it’s a waste of time posting photographs of your screen. Ther information is unintelligible.
You should take screenshots with Windows Sniping tool or similar then paste them into your post.

Pete.

@farisilyasa, as you’ve chosen to create an entirely new thread with correctly formatted code and screenshots rather than photographs, I’m locking this thread.
When I said:

I mean that you should use the pencil icon at the bottom of your post to edit the content:

image

In future please edit rather than creating a new post or a completely new topic.

For anyone who is interested, the new topic is here:

Pete.