01-30-2023, 07:18 PM
Hello!
I tried to deal with OLED and digital inputs. Separately the OLED code and the inputs code work correctly. When I was trying to put the code at the same skecth it hasn't been worked properly.
As far as I could understand the issue is related to the I2C bus and the u8g2lib. I found that the Wire.begin() and u8g2.begin() use SetClock. The SetClock issue resolved at the 2.33 version of the u8g2 library by U8x8_DO_NOT_SET_WIRE_CLOCK definition. In my case the definition has no effect.
Please let me know what the way to use u8g2 library as wrotten at the thread beginning with the Wire object at the same time.
I tried to deal with OLED and digital inputs. Separately the OLED code and the inputs code work correctly. When I was trying to put the code at the same skecth it hasn't been worked properly.
Code:
#define U8x8_DO_NOT_SET_WIRE_CLOCK
#include <U8g2lib.h>
#include <Wire.h>
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, 15, 4, U8X8_PIN_NONE);//SCL IO15 SDA IO4
...
void setup()
{
// init IIC
Wire.begin(I2C_SDA, I2C_SCL); //If this line was commented the screen would work properly but the inputs wouldn't.
...
u8g2.setI2CAddress(0x3C*2);
u8g2.begin();
u8g2.enableUTF8Print();
}
As far as I could understand the issue is related to the I2C bus and the u8g2lib. I found that the Wire.begin() and u8g2.begin() use SetClock. The SetClock issue resolved at the 2.33 version of the u8g2 library by U8x8_DO_NOT_SET_WIRE_CLOCK definition. In my case the definition has no effect.
Please let me know what the way to use u8g2 library as wrotten at the thread beginning with the Wire object at the same time.