#include <ESP32WiFi.h>
#include <EEPROM.h>
#include
int val;
#define wifi_name "Your SSID"
#define password "Your Wifi Password"
#define server "io.adafruit.com"
#define port 1883
#define username "Your Adafruit User ID"
#define aio key "Your AIO Key"
#define USE_SERIAL Serial
#define GAS_SENSOR A0
//A0 of NodeMCU is connected to Analog pin of MQ-02
void setup( )
{
Serial.begin(115200);
delay(10);
}
void loop()
{
val=analogRead(GAS_SENSOR):
// Analog read for reading any analog input.
Serial.print (val);
// Here, we print the value read through the serial monitor.
Serial.println (" ");
delay(100);
}
WiFiClient me;
Adafruit MQTT Client mqtt (&me, server, port, username, aiokey);
Adafruit MQTT_Publishgas_data = Adafruit_MQTT_Publish (&mqtt, username"/feeds/Gas sensor");
void setup()
{
Serial.begin (115200);
delay(10);
Serial.println("Connecting to");
Serial.print(wifi_name);
WiFi.begin (wifi_name, password);
while(WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Loading
franzininho-wifi
franzininho-wifi