Closed lingxiaomeng closed 5 years ago
i put oled128*128 with ssd1327 and ds3231 on the same SCL and SDA but they can not work together. `#include "DS3231.h"
RTClib RTC;
U8G2_SSD1327_EA_W128128_F_SW_I2C u8g2(U8G2_R0, / clock=/ SCL, / data=/ SDA, / reset=/ U8X8_PIN_NONE);
LiquidCrystal_I2C lcd(0x27, 16, 2); void setup () { u8g2.setI2CAddress(0x3C*2); u8g2.begin(); delay(5000); Serial.begin(57600); Wire.begin(); //lcd.init();
// Print a message to the LCD. //lcd.backlight(); //lcd.print("Hello, world!"); // u8g2_SetI2CAddress(u8g2.GetU8g2(),0x3C*2);
}`
You must use the HW I2C constructor: U8G2_SSD1327_EA_W128128_F_HW_I2C
See also https://github.com/olikraus/u8g2/blob/master/doc/faq.txt#L9
thank you it was solved
:-)
i put oled128*128 with ssd1327 and ds3231 on the same SCL and SDA but they can not work together. `#include "DS3231.h"
include
include
ifdef U8X8_HAVE_HW_SPI
include
endif
ifdef U8X8_HAVE_HW_I2C
include
endif
RTClib RTC;
include
U8G2_SSD1327_EA_W128128_F_SW_I2C u8g2(U8G2_R0, / clock=/ SCL, / data=/ SDA, / reset=/ U8X8_PIN_NONE);
LiquidCrystal_I2C lcd(0x27, 16, 2); void setup () { u8g2.setI2CAddress(0x3C*2); u8g2.begin(); delay(5000); Serial.begin(57600); Wire.begin(); //lcd.init();
// Print a message to the LCD. //lcd.backlight(); //lcd.print("Hello, world!"); // u8g2_SetI2CAddress(u8g2.GetU8g2(),0x3C*2);
}`