Hello comunity
I wanted to build an internett test device using an ESP8266.
When the internet works a green LED should light up and when the internet does not work a red one.
For this I have found the script in the internett but I can not install it on the ESP 8266.
I have installed all libraries but I get this error:
Error compiling for the board NodeMCU 0.9 (ESP-12 Module).
Can someone help me
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <WiFiNINA.h>
#define greenLED 8
#define redLED 9
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADDR 0x3C
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);
char ssid[] = "test";
char pass[] = "";
int status = WL_IDLE_STATUS;
String google = "www.google.com";
String salesforce = "www.salesforce.com";
IPAddress localServer(172, 16, 42, 5);
int googleResult;
int salesforceResult;
int serverResult;
int gatewayResult;
void setup() {
pinMode(greenLED, OUTPUT);
pinMode(redLED, OUTPUT);
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to Network named: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(10000);
}
String ssid = WiFi.SSID();
IPAddress ip = WiFi.localIP();
IPAddress gateway = WiFi.gatewayIP();
IPAddress subnet = WiFi.subnetMask();
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Net Tester");
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 17);
display.print("SSID: ");
display.println(ssid);
display.print("IP: ");
display.println(ip);
display.print("Subnet: ");
display.println(subnet);
display.print("Gateway:");
display.println(gateway);
display.display();
delay(5000);
}
void loop() {
IPAddress gateway = WiFi.gatewayIP();
googleResult = WiFi.ping(google);
salesforceResult = WiFi.ping(salesforce);
serverResult = WiFi.ping(localServer);
gatewayResult = WiFi.ping(gateway);
long counter = millis();
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Net Tester");
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 17);
display.print("Gateway: ");
display.println(gatewayResult);
display.print("Local Server: ");
display.println(serverResult);
display.print("Google: ");
display.println(googleResult);
display.print("Salesforce: ");
display.println(salesforceResult);
display.println(counter);
display.display();
if (gatewayResult < 0 || serverResult < 0 || googleResult < 0 || salesforceResult < 0) {
digitalWrite(greenLED, LOW);
digitalWrite(redLED, HIGH);
} else {
digitalWrite(greenLED, HIGH);
digitalWrite(redLED, LOW);
}
delay(5000);Prüfungsvorbere
}