Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I dont't know what constructor use. #2504

Open
JPRIPKE opened this issue Sep 9, 2024 · 9 comments
Open

I dont't know what constructor use. #2504

JPRIPKE opened this issue Sep 9, 2024 · 9 comments

Comments

@JPRIPKE
Copy link

JPRIPKE commented Sep 9, 2024

I did a program with the u8g2 lib and at the wokwi simulator worked very well, but I was trying to use in the real life and don't work.
Probably the error is the constructor, i have tried all the constructor of the doc.
Can anyone help me? or explain, how can i discover what constructor i need to use?

Informations:
SSD1309
128x64
I2C
2,42"

@olikraus
Copy link
Owner

olikraus commented Sep 9, 2024

@JPRIPKE
Copy link
Author

JPRIPKE commented Sep 10, 2024

Yes, i tried all of that list, but none worked, i wanna to know how can i choose the correct one.
I must try again that constructors.
tr Thanks.

@JPRIPKE
Copy link
Author

JPRIPKE commented Sep 10, 2024

U8GLIB_SSD1309_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK);

When i use the u8g Lib that constructor works very well, probably that information could be important

@olikraus
Copy link
Owner

I suggest to try with "U8G2_SSD1309_128X64_NONAME0_F_SW_I2C" or "U8G2_SSD1309_128X64_NONAME2_F_SW_I2C". Provide the pin numbers where your display is connected.
This constructor should be compatible with the u8g constructor.

@JPRIPKE
Copy link
Author

JPRIPKE commented Sep 10, 2024

nonething happened, read the code, maybe you can see any wrong
I'm using the arduino mega, whithout change the pinout of SDA and SCLK

U8G2_SSD1309_128X64_NONAME0_F_SW_I2C u8g2(/rotation/U8G2_R0,/clock/ 21,/data/ 20, /reset/ U8X8_PIN_NONE);

//U8G2_SSD1309_128X64_NONAME2_F_SW_I2C u8g2(/rotation/U8G2_R0,/clock/ 21,/data/ 20, /reset/ U8X8_PIN_NONE);

@JPRIPKE
Copy link
Author

JPRIPKE commented Sep 10, 2024

Worked, thank you. I tried a example code, probably i wrote anything wrong at my code.
Do you have any tip to me debug? Because when i run that code at wokwi run well

@JPRIPKE
Copy link
Author

JPRIPKE commented Sep 10, 2024

i just discovered the problem, when i write "rtc.begin();" the display stop the work.
i going to reserch to fix that.

@JPRIPKE
Copy link
Author

JPRIPKE commented Sep 10, 2024

"SSD1306 display supports I2C at 400KHz, the DS1307 does not. if the RTC library is poorly written and does not check the bus frequency before using it as per arduino guidance then it will fail to work. you should be able to either set the clock to 100KHz yourself prior to using the RTC, or set the bus clock to 100KHz in u8g2" I found that, could you explain to me where do that change into the (.h) or (.cpp) of u8g2 lib

@olikraus
Copy link
Owner

You can slow down u8g2 as mentioned in #1392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants