Files
ESP32-WiFi-BME/src/main.cpp
T
2026-05-22 11:04:39 -06:00

40 lines
754 B
C++

#include "Arduino.h"
#include "WiFiConf.h"
#include "WebSocketHandler.h"
#include <WebSocketsServer.h>
// Conf de ESP32-S3 en modo STA
const char* SSID="Tenda_32C850";
const char* PASSWD="rhLcrMEcY^Xjvq66";
IPAddress local_ip(192,168,0,220);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
IPAddress dns1(192,168,0,100);
IPAddress dns2(1,1,1,1);
wifi_conf sta_esp32;
WebSocketsServer webSocket(81);
volatile bool websocket_connected = false;
void setup() {
Serial.begin(230400);
sta_esp32.conectar(SSID, PASSWD, local_ip, gateway, subnet, dns1, dns2);
webSocket.begin();
webSocket.onEvent(webSocketEvent);
}
void loop() {
webSocket.loop();
uint8_t imagen = 0;
webSocket.broadcastBIN(&imagen, 1);
delay(10);
}