#define LED 2
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(LED,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
delay(1000);
digitalWrite(LED,HIGH);
Serial.println("LED ON");
delay(1000);
digitalWrite(LED,LOW);
Serial.println("LED OFF");
}
// #include <DHTesp.h>
// // #include <dht.h>
// #include <WiFi.h>
// #include <ThingsBoard.h>
// #define pinDht 15
// DHTesp dhtSensor;
// #define WIFI_AP "Wokwi-GUEST"
// #define WIFI_PASS ""
// #define TB_SERVER "demo.thingsboard.io"
// #define TOKEN "oYCUiUxeT34b0KN6pKCF"
// WiFiClient espClient;
// ThingsBoard tb(espClient);
// void setup() {
// // put your setup code here, to run once:
// Serial.begin(115200);
// Serial.println("Hello, ESP32!");
// dhtSensor.setup(pinDht, DHTesp::DHT22);
// initWiFi();
// while(!tb.connected()){
// Serial.println("Not Connected to Thingsboard");
// if(!tb.connect(TB_SERVER, TOKEN)){
// Serial.println("Still not connected");
// return;
// }else{
// Serial.println("Connected to Thingsboard");;
// }
// }
// }
// void loop() {
// // put your main code here, to run repeatedly:
// delay(10); // this speeds up the simulation
// TempAndHumidity data = dhtSensor.getTempAndHumidity();
// float temp = data.humidity;
// int hum = data.humidity;
// Serial.println(temp);
// Serial.println(hum);
// // tb.sendTelemetryFloat("Temperature", temp);
// tb.sendTelemetryData("Temperature", temp);
// // tb.sendTelemetryFloat("Humidity", hum);
// Serial.println("Data sent ...");
// delay(5000);
// }
// void initWiFi(){
// Serial.println("Conecting ....");
// WiFi.begin(WIFI_AP,WIFI_PASS, 6);
// while(WiFi.status() != WL_CONNECTED){
// Serial.print(".");
// delay(100);
// }
// Serial.println("Connected!");
// }