// Quick and Dirty tests:
// The normal hd44780 works on the pins that are defined with Wire.begin().
// The "Adafruit LiquidCrystal" can work with Wire and Wire1, but does
// not seem compatible with the Wokwi display.
//
// Using a include that has no Wire.begi()) and uses _WIRE_
//
// Forum: https://forum.arduino.cc/t/20x2-display-with-hd44780-with-second-i2c-bus/1187177/7
// This Wokwi project: https://wokwi.com/projects/380942943314336769
#include <Wire.h>
#include <hd44780.h> // the well maintained LCD library
//#include <hd44780ioClass/hd44780_I2Cexp.h>
// Select the I2C bus, try Wire and Wire1
//#define _WIRE_ Wire
#define _WIRE_ Wire1
#include "hd44780_I2Cexp_test.h"
#include <LiquidCrystal_I2C.h> // the old library for 'Wire'
#include <U8g2lib.h> // A modern OLED library
const int LCD_COLS = 16;
const int LCD_ROWS = 2;
hd44780_I2Cexp lcd1(0x30,LCD_COLS,LCD_ROWS); // set specific address
hd44780_I2Cexp lcd2(0x32,LCD_COLS,LCD_ROWS); // set specific address
hd44780_I2Cexp lcd3(0x34,LCD_COLS,LCD_ROWS); // set specific address
LiquidCrystal_I2C lcd4(0x30, LCD_COLS, LCD_ROWS);
LiquidCrystal_I2C lcd5(0x32, LCD_COLS, LCD_ROWS);
LiquidCrystal_I2C lcd6(0x34, LCD_COLS, LCD_ROWS);
U8X8_SSD1306_128X64_NONAME_HW_I2C display(U8X8_PIN_NONE);
void setup()
{
// Do not call Wire.begin() if it is already called.
Wire.begin(4,15); // SDA, SCL
Wire1.begin(25,26); // SDA, SCL
int status1 = lcd1.begin(LCD_COLS, LCD_ROWS);
int status2 = lcd2.begin(LCD_COLS, LCD_ROWS);
int status3 = lcd3.begin(LCD_COLS, LCD_ROWS);
lcd4.init();
lcd4.backlight();
lcd5.init();
lcd5.backlight();
lcd6.init();
lcd6.backlight();
display.begin();
display.setPowerSave(0);
// This font is (too) small.
display.setFont(u8x8_font_pxplusibmcgathin_f);
lcd1.setCursor(0, 0); // column, row
lcd1.print( "Hello Display 1");
lcd2.setCursor(0, 0); // column, row
lcd2.print( "Hello Display 2");
lcd3.setCursor(0, 0); // column, row
lcd3.print( "Hello Display 3");
lcd4.setCursor(0, 0);
lcd4.print("Hello Display 4");
lcd5.setCursor(0, 0);
lcd5.print("Hello Display 5");
lcd6.setCursor(0, 0);
lcd6.print("Hello Display 6");
display.setCursor(0,7);
display.print("Hello OLED");
}
void loop()
{
delay(10);
}A "Wire1" bus at pin 25,26
A "Wire" bus at pin 4,15