#if defined(ESP8266)
#include <ESP8266WIFI.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
#define WIFI_SSID "Wokwi-GUEST"
#define WIFI_PASSWORD ""
#define SERIAL_DEBUG_BAUD 115200
int status = WL_IDLE_STATUS;
#define LED 2
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Muammar khadhafi");
pinMode(13, INPUT);
pinMode(LED, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
//this speeds up the simulation
int tekan = digitalRead(13);
if(tekan == 1){
Serial.println("Connecting to AP ...");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.print("The network is connected to ");
Serial.println(WIFI_SSID);
Serial.print("IP: ");
Serial.println(WiFi.localIP());
digitalWrite(LED, HIGH);
}
else {
}
}