Hi,
I have been trying to run two SSD1306_128X64 OLED's using the code I found on the forum but only manage to display on one (0x78) though I do know that the other OLED (0x7A) is addressable and works OK when used separately using another library.
I intended to use two Oled's using one Ardunio Nano.
Not sure why it does not works as it is mentioned that the code works perfectly OK...any help please.
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
extern uint8_t I2C_SLA;
uint8_t I2C_SLA = 0x7A;
boolean redraw_display_one = false;
boolean redraw_display_two = false;
void setup()
{
I2C_SLA = 0x078;
u8g.firstPage();
do
{
draw_message_one();
}
while(u8g.nextPage());
delay(10);
I2C_SLA = 0x07A;
u8g.firstPage();
do
{
draw_message_two();
}
while(u8g.nextPage());
}
void loop()
{
if (redraw_display_one)
{
I2C_SLA = 0x078;
u8g.firstPage();
do
{
draw_message_two();
}
while(u8g.nextPage());
redraw_display_one = false;
}
if (redraw_display_two)
{
I2C_SLA = 0x07A;
u8g.firstPage();
do
{
draw_message_one();
}
while(u8g.nextPage());
redraw_display_two = false;
}
unsigned long time = millis();
if (time > 5000 && time < 5033)
{
redraw_display_one = true;
redraw_display_two = true;
}
}
void draw_message_one()
{
u8g.setFont(u8g_font_fub20);
u8g.drawStr(12, 28, "Hello");
u8g.drawStr(12, 58, "World");
}
void draw_message_two()
{
u8g.setFont(u8g_font_fub20);
u8g.drawStr(12, 28, "Goodbye");
u8g.drawStr(12, 58, "World");
}