Hi,
Just receive my brand new XIAO ESP32C3 as well as the Seeed Studio Expansion Base (the one with the OLED display), plus a few grove accessories.
If everything seems to work well, I have an issue. Impossible to make the OLED display working.
I downloaded the library (U8g2) as mentionned in the WiKi aboute the expansion base, I copied the code from the WikI, it compile, it download but the display continue to be completlly blank.
I could make the BME280 sensor work well and display the values on the Serial Monitor but impossible to use the OLED on the Expansion Base.
Any idea ?
Many thanks.
The interface of the OLED display is I2C, how is it configured?
The OLED display is part of the board, nothing (apparently) to configure.
Here is the code I copied from the WiKi from Seeed Studio :
*#include <Arduino.h>*
*#include <U8x8lib.h>*
*#include <Wire.h>*
* *
*U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ PIN_WIRE_SCL, /* data=*/ PIN_WIRE_SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display*
* *
*void setup(void) {*
* u8x8.begin();*
* u8x8.setFlipMode(1); // set number from 1 to 3, the screen word will rotary 180*
*}*
* *
*void loop(void) {*
* u8x8.setFont(u8x8_font_chroma48medium8_r);*
* u8x8.setCursor(0, 0);*
* u8x8.print("Hello World!");*
*}*
And here is the error I get when I compile :
/tmp/.arduinoIDE-unsaved2023015-42259-ri52n4.ided/sketch_jan15a/sketch_jan15a.ino:5:52: error: 'PIN_WIRE_SCL' was not declared in this scope
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ PIN_WIRE_SCL, /* data=*/ PIN_WIRE_SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
^~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved2023015-42259-ri52n4.ided/sketch_jan15a/sketch_jan15a.ino:5:52: note: suggested alternative: 'PIN_CTRL'
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ PIN_WIRE_SCL, /* data=*/ PIN_WIRE_SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
^~~~~~~~~~~~
PIN_CTRL
/tmp/.arduinoIDE-unsaved2023015-42259-ri52n4.ided/sketch_jan15a/sketch_jan15a.ino:5:77: error: 'PIN_WIRE_SDA' was not declared in this scope
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ PIN_WIRE_SCL, /* data=*/ PIN_WIRE_SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
^~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved2023015-42259-ri52n4.ided/sketch_jan15a/sketch_jan15a.ino:5:77: note: suggested alternative: 'FUN_IE_S'
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ PIN_WIRE_SCL, /* data=*/ PIN_WIRE_SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
^~~~~~~~~~~~
FUN_IE_S
exit status 1
Compilation error: 'PIN_WIRE_SCL' was not declared in this scope
I don’t know what to do at this stage !
Many thanks
What is the “*” in the sketch?
If change it as shown below, it works, but the IDE hangs on my environment.
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
“Adafruit_SSD1306” library works fine.
The compiler reports the error:
Compilation error: 'PIN_WIRE_SCL' was not declared in this scope
add a definition before the u8x8
declaration for the XIAO on Expansion board:
#define PIN_WIRE_SCL D5
where D5 is the pin name for I2C SCL (clock) signal
#define PIN_WIRE_SDA D4
where D4 is the pin name for I2C SDA (data) signal
note I do not have an ESP32 to actually try so the actual pin names be different for you.
You can also try:
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
and use default SCL/SDA for board.
Many thanks for your valuable help. In fact I used the solution of @ricksorensen to declare the u8x8 :
> U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/ reset=/ U8X8_PIN_NONE);
But I had to unplug the XIAO as well as the battery and repower the XIAO to make the display work.
Many thanks.