#include <WiFi.h>
#include <SPI.h>
#include <PubSubClient.h>
WiFiClient wclient;
PubSubClient client;
String payload, topic;
String ssid;
String password;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
ssid = "Wokwi-GUEST";
password = "";
payload = "hello";
topic = "/lglsi3/message/";
WiFi.begin(ssid, password);
while(WiFi.status() != WL_CONNECTED){
Serial.print('.');
delay(1000);
}
client.setClient(wclient);
client.setServer("Test.mosquitto.org",1883);
client.connect("ayoub");
}
void loop() {
client.publish("/lglsi3/message/", "hello");
delay(10); // this speeds up the simulation
}