When I have the Arduino board set in the IDE, everything works normally except for network discovery. However, if I switch to the ESP board in the IDE, the display stops working
#include <ESP8266WiFi.h>
#include <U8g2lib.h>
// U8g2 Constructor
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
void setup() {
// Initialize the display
u8g2.begin();
// Initialize serial communication for debugging
Serial.begin(9600);
while (!Serial);
// Draw initial message
u8g2.setFont(u8g2_font_ncenB10_tr);
u8g2.clearBuffer();
u8g2.drawStr(0, 20, "Scanning WiFi...");
u8g2.sendBuffer();
// Start WiFi scan
int numNetworks = WiFi.scanNetworks();
// Check if any networks were found
if (numNetworks == 0) {
Serial.println("No networks found");
u8g2.clearBuffer();
u8g2.drawStr(0, 20, "No networks found");
u8g2.sendBuffer();
} else {
Serial.print(numNetworks);
Serial.println(" networks found");
// Print networks to serial and display
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_ncenB10_tr);
for (int i = 0; i < numNetworks; i++) {
String ssid = WiFi.SSID(i);
int rssi = WiFi.RSSI(i);
String msg = ssid + " RSSI: " + String(rssi) + "dBm";
Serial.println(msg);
u8g2.drawStr(0, 10 + i * 10, msg.c_str());
}
u8g2.sendBuffer();
}
// Delay to display the results
delay(5000); // 5 seconds delay
}
void loop() {
// Your main code here
}
...and give us a better description of the problem, because I honestly admit haven't got much of that statement (and without a clean code it's harder).
When I have the Arduino board set in the IDE, everything works normally except for network discovery. However, if I switch to the ESP board in the IDE, the display stops working