Hello everyone,
I state that I entered very little in the Arduino world so I apologize if I will be very "elementary" in my explanation. I would like to remotely (via Blynk) display the value of the gas.
Currently the links I have made only the following:
Arduino one is powered by the pc
Esp-01 connected to the PC in this way:
Gnd -> Gnd
GPIO2 -> nothing
GPIO0 -> Gnd
RXD -> Rx arduino
TXD -> Tx arduino
CH_PD -> 3.3v arduino
RESET -> nothing
VCC -> 3.3v arduino
MQ-2 connected as follows:
VCC -> 5V arduino
GND -> gnd
A0 -> A0
Sketch:
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int gas = A0;
int smoke;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";
BLYNK_READ(V5)
{
smoke = analogRead(gas);
Blynk.virtualWrite(V5,smoke);
Serial.println(smoke);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(gas,INPUT);
}
void loop()
{
Blynk.run();
}
The connection is successful on blynk but the value of the gas that is passed is incorrect.
Would you tell me where the error is and / or if I need more material?
Sorry for the ignorance but for some time I'm banging my head: smiley-confused:
Thank you all