#include <SPI.h>
#include <WiFi.h>
const char* ssid = "Wokwi-GUEST";
const char* password = "";
int ledPin = 18; // Pin 18 for the LED
IPAddress ip(192,168,100,10); // IP Adress for the shield
IPAddress gateway(192, 168, 100, 1); // the router's gateway address:
IPAddress subnet(255, 255, 255, 0); // the subnet:
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
Serial.println("Waiting for serial port to connect");
delay(1000);
; // wait for serial port to connect. Needed for Leonardo only
}
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
WiFi.config(ip,gateway,subnet);
while ( WiFi.status() != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
WiFi.begin(ssid, password);
delay (1000);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.println("Subnet Mask: ");
Serial.println(WiFi.subnetMask());
Serial.println("Gateway: ");
Serial.println(WiFi.gatewayIP());
Serial.println("Started Streaming Online!");
digitalWrite(ledPin, HIGH); // Turn on the LED
}
void loop() {
// Your main code here
}