Hello, I want the wifi icon to be displayed on the oled when connected to wifi, and when disconnected display "x"
Have any idea. thank you
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
//
#include <WiFiManager.h>
WiFiManager wm;
const unsigned char wifiicon[] PROGMEM ={ // wifi icon
0x00, 0xff, 0x00, 0x7e, 0x00, 0x18,0x00, 0x00
};
void setup() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
// put your setup code here, to run once:
Serial.begin(115200);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
//reset settings - wipe credentials for testing
//wm.resetSettings();
wm.setConfigPortalBlocking(false);
wm.setConfigPortalTimeout(10);
//automatically connect using saved credentials if they exist
//If connection fails it starts an access point with the specified name
if(wm.autoConnect("AutoConnec","aa")){
Serial.println("connected...yeey :)");
display.clearDisplay();
display.drawBitmap(120,1,wifiicon,8,8,WHITE);
display.display();
}
else {
Serial.println("Configportal running");
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(WHITE); // Draw white text
display.setCursor(0,0); // Start at top-left corner
display.println("x");
display.display();
}
}
int x;
void loop() {
wm.process();
x++;
Serial.println(x);
delay(1000);
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(WHITE); // Draw white text
display.setCursor(0,0);
display.println(x);
display.display();
}