// Example of multiple software I2C buses with shared SCL.
//
// This is a proof of concept.
// The library files had to be changed to hold a pointer to a SoftwareWire object.
// There is no conflict with the Arduino hardware Wire library.
// It is still possible to connect sensors to the hardware I2C bus.
//
// A better version by arcostasi is here:
// https://wokwi.com/arduino/projects/307853926099583552
//
//
// Very nice big font:
// https://www.instructables.com/Custom-Large-Font-For-16x2-LCDs/
//
#include <SoftwareWire.h>
// Create three software I2C buses
SoftwareWire wire1( 10, SCL);
SoftwareWire wire2( 9, SCL);
SoftwareWire wire3( 8, SCL);
#include "LiquidCrystal_I2C_soft.h"
// Create an object for each LCD display
LiquidCrystal_I2C lcd1a( &wire1, 0x27, 20, 4);
LiquidCrystal_I2C lcd1b( &wire1, 0x3F, 20, 4);
LiquidCrystal_I2C lcd2a( &wire2, 0x27, 20, 4);
LiquidCrystal_I2C lcd2b( &wire2, 0x3F, 20, 4);
LiquidCrystal_I2C lcd3a( &wire3, 0x27, 20, 4);
LiquidCrystal_I2C lcd3b( &wire3, 0x3F, 20, 4);
void setup()
{
lcd1a.init();
lcd1a.backlight();
lcd1a.setCursor(0,0);
lcd1a.print("Hello Display 1a");
lcd1a.setCursor(0,1);
lcd1a.print("0x27, I2C bus 1");
lcd1b.init();
lcd1b.backlight();
lcd1b.setCursor(0,0);
lcd1b.print("Hello Display 1b");
lcd1b.setCursor(0,1);
lcd1b.print("0x3F, I2C bus 1");
lcd2a.init();
lcd2a.backlight();
lcd2a.setCursor(0,0);
lcd2a.print("Hello Display 2a");
lcd2a.setCursor(0,1);
lcd2a.print("0x27, I2C bus 2");
lcd2b.init();
lcd2b.backlight();
lcd2b.setCursor(0,0);
lcd2b.print("Hello Display 2b");
lcd2b.setCursor(0,1);
lcd2b.print("0x3F, I2C bus 2");
lcd3a.init();
lcd3a.backlight();
lcd3a.setCursor(0,0);
lcd3a.print("Hello Display 3a");
lcd3a.setCursor(0,1);
lcd3a.print("0x27, I2C bus 3");
lcd3b.init();
lcd3b.backlight();
lcd3b.setCursor(0,0);
lcd3b.print("Hello Display 3b");
lcd3b.setCursor(0,1);
lcd3b.print("0x3F, I2C bus 3");
}
void loop() { }