Closed FGasper closed 4 years ago
It appears that specifying the reset pin is needed. I’m going to leave this issue open in case an update to the docs seems warranted.
Thank you!
Hmm.. you skip the reset pin from my perspective, the problem seems to be the "void" argument, which is probably not valid:
U8X8_SSD1305_128X32_NONAME_2ND_HW_I2C u8x8(void);
This should be
U8X8_SSD1305_128X32_NONAME_2ND_HW_I2C u8x8();
instead.
Actually this is not a u8g2 issue more a general C++ topic.
I see this is closed, but I do have the same error when doing
U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8();
(without literally specifying void
as a parameter). Is this expected behavior?
Which error exactly you have?
The relevant parts of my code are:
#include <U8x8lib.h>
U8X8_SSD1306_128X32_UNIVISION_HW_I2C display();
void printOnDisplay(std::string text, bool keepOnDisplay)
{
display.drawString(0, 0, text.c_str());
if (!keepOnDisplay)
{
delay(1000);
display.clearDisplay();
}
}
void setup()
{
display.begin();
printOnDisplay(std::string("Hello"), true);
delay(3000);
display.clearDisplay();
}
void loop()
{
}
The relevant errors I get are:
Hm strange. Maybe try:
U8X8_SSD1306_128X32_UNIVISION_HW_I2C display(U8X8_PIN_NONE);
Sorry for my late response!
U8X8_SSD1306_128X32_UNIVISION_HW_I2C display(U8X8_PIN_NONE);
works!
Which is odd though, because the constructor does have a default parameter value: https://github.com/olikraus/u8g2/blob/a543c481319f381e91c0caea664b7be5ade59635/cppsrc/U8x8lib.h#L2143
I don't have the C++ experience to understand why this still happens, so unfortunately I cannot create a PR for this.
Would it be possible to update the docs at https://github.com/olikraus/u8g2/wiki/u8x8setupcpp#ssd1306-128x32_univision-1? There the parameter is marked optional.
I agree, your constructor should also work. Maybe Arduino IDE changes something here. It runs a preprocessor on the code. :-/
Hello,
Maybe I’m misunderstanding something in the documentation, but when I replace:
… with:
… and try to verify the code, Arduino IDE gives me:
Here’s my full sketch; is there something I’m missing?
Thank you!