first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for AdaFruit_LiquidCrystal in 4bit mode
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in the hd44780 examples.
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Adafruit_LiquidCrystal.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare Arduino pins used for LCD functions
// and the lcd object
//const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // pins used by IDE LiquidCrystal examples
const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins
Adafruit_LiquidCrystal lcd(rs, en, db4, db5, db6, db7);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,40 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for Adafruit_LiquidCrystal using i2c
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <Adafruit_LiquidCrystal.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address must match the backpack address
// and the library only works with the MCP23008 based #292 backpack
const uint8_t i2cAddr = 0; // default i2c address for #292 board
Adafruit_LiquidCrystal lcd(i2cAddr);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,47 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for Adafruit_LiquidCrystal using i2c
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <Adafruit_LiquidCrystal.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
#if ARDUINO < 157
#error "This sketch Requires Arduino 1.5.7 or higher"
#endif
// NOTE: uses API that only works on IDE 1.5.7 and up
#define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address must match the backpack address
// and the library only works with the MCP23008 based #292 backpack
const uint8_t i2cAddr = 0; // default i2c address for #292 board
Adafruit_LiquidCrystal lcd(i2cAddr);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,19 @@
Adafruit_LiquidCrystal hd44780 examples
========================================
The Adafruit_LiquidCrystal library must be installed in order to use these sketches.
#### The examples are broken up into various sub directories.
* `4bit`<br>
Contains example sketches that are for LCDs that are wired up directly to Arduino pins.
* `I2C`<br>
Contains example sketches that are for LCDs connected to an Adafruit #292 backpack when using the i2c MCP23008 i/o expander chip to control the LCD.
* `SPI`<br>
Contains example sketches that are for LCDs connected to an Adafruit #292 backpack when using the shift register to control the LCD.
Note: that while adafruit uses the term "SPI" the #292 backpack it is not using SPI.
It is mearly using a shift register.
Also, the Adafruit_liquidCrystal library is not using the SPI h/w but rather simply calling the s/w shiftout() function to do the transfer.

View File

@@ -0,0 +1,37 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for Adafruit_LiquidCrystal shiftreg mode
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <Adafruit_LiquidCrystal.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// declare the lcd object for shift register mode
const uint8_t clkPin = 2;
const uint8_t datPin = 3;
const uint8_t latPin = 4;
Adafruit_LiquidCrystal lcd(datPin, clkPin, latPin);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,5 @@
LiquidCrystal hd44780 examples
==============================
The LiquidCrystal library comes bundled with the IDE.
It controls the LCD using Arduino pins directly connected to the LCD.

View File

@@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in the hd44780 examples.
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <LiquidCrystal.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare Arduino pins used for LCD functions and the lcd object
//const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins
const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins
LiquidCrystal lcd(rs, en, db4, db5, db6, db7);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in the hd44780 examples.
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <LiquidCrystalFast.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare Arduino pins used for LCD functions and the lcd object
//const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins
const int rs=8, rw=3, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins
LiquidCrystalFast lcd(rs, rw, en, db4, db5, db6, db7);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in the hd44780 examples.
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <LiquidCrystalFast.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare Arduino pins used for LCD functions and the lcd object
//const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins
const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins
LiquidCrystalFast lcd(rs, en, db4, db5, db6, db7);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,12 @@
LiquidCrystalFast hd44780 examples
=================================
LiquidCrystalFast library must be installed in order to use these sketches.<br>
#### The examples are broken up into sub directories for with/without R/W pin
* `LiquidCrystalFastnoRW`<br>
Contains example sketches that are for LCDs that are wired up directly to Arduino pins without the R/W pin
* `LiquidCrystalFastRW`<br>
Contains example sketches that are for LCDs that are wired up directly to Arduino pins with the R/W pin

View File

@@ -0,0 +1,14 @@
LiquidCrytsalIO hd44780 examples
=================================
LiquidCrystalIO and IoAbstration libraries must be installed in order to use these sketches.<br>
The liquidCrystalIO library contains multiple i/o classes.
#### The examples are broken up into various sub directories for each i/o class
* `ioUsingArduino`<br>
Contains example sketches that are for LCDs that are wired up directly to Arduino pins.
* `iofrom8574`<br>
Contains example sketches that are for LCDs connected to a backpack using the i2c PCF8574 i/o expander chip to control the LCD.

View File

@@ -0,0 +1,61 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test: LiquidCrystalIO with ioFrom8574
// ----------------------------------------------------------------------------
// NOTE: this also requires the IoAbstration library
//
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h> // bundled Wire library
#include <IoAbstractionWire.h> // from IoAbstration library
#include <LiquidCrystalIO.h> // from LiquidCrystalIO library
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address and pin mappings must match the backpack
// The pin mapping selected matches the "LiquidCrystal_I2C" library
// in the IDE library manager.
const uint8_t i2cAddr = 0x27;
const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3;
LiquidCrystal lcd(rs, rw, en, db4, db5, db6, db7, ioFrom8574(i2cAddr));
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// tell lcd hd44780 sketch to call Wire.begin()
#define LCDISPEED_CALL_WIRE_BEGIN
// tell lcd hd44780 sketch to call custom customLCDinit() for initialization
#define LCDISPEED_CALL_CUSTOM_LCDINIT
void custom_LCDinit(void);
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>
// have to use custom initialzation for this library
void custom_LCDinit(void)
{
Wire.begin();
lcd.configureBacklightPin(bl); // assumes active HIGH
lcd.begin(LCD_COLS, LCD_ROWS);
lcd.backlight();
}

View File

@@ -0,0 +1,68 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test: LiquidCrystalIO with ioFrom8574
// ----------------------------------------------------------------------------
// NOTE: this also requires the IoAbstration library
//
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h> // bundled Wire library
#include <IoAbstractionWire.h> // from IoAbstration library
#include <LiquidCrystalIO.h> // from LiquidCrystalIO library
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
#if ARDUINO < 157
#error "This sketch Requires Arduino 1.5.7 or higher"
#endif
// NOTE: uses API that only works on IDE 1.5.7 and up
#define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address and pin mappings must match the backpack
// The pin mapping selected matches the "LiquidCrystal_I2C" library
// in the IDE library manager.
const uint8_t i2cAddr = 0x27;
const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3;
LiquidCrystal lcd(rs, rw, en, db4, db5, db6, db7, ioFrom8574(i2cAddr));
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// tell lcd hd44780 sketch to call Wire.begin()
#define LCDISPEED_CALL_WIRE_BEGIN
// tell lcd hd44780 sketch to call custom customLCDinit() for initialization
#define LCDISPEED_CALL_CUSTOM_LCDINIT
void custom_LCDinit(void);
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>
// have to use custom initialzation for this library
void custom_LCDinit(void)
{
Wire.begin();
lcd.configureBacklightPin(bl); // assumes active HIGH
lcd.begin(LCD_COLS, LCD_ROWS);
lcd.backlight();
}

View File

@@ -0,0 +1,43 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test: LiquidCrystalIO with ioUsingArduino
// ----------------------------------------------------------------------------
// NOTE: this also requires the IoAbstration library
//
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <LiquidCrystalIO.h> // from LiquidCrystalIO library
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare Arduino pins used for LCD functions and the lcd object
// this will use 4 bit mode using Arduino pins
//const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins
const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins
LiquidCrystal lcd(rs, en, db4, db5, db6, db7);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
void custom_LCDinit(void);
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,24 @@
LiquidCrystal_I2C hd44780 examples
==================================
These examples require that the LiquidCrystal_I2C library be installed.
The LiquidCrystal_I2C library can be installed using the IDE library manager.
It controls the LCD using an PCF8574 i/o expander backpack.
The library assumes a paticular wiring between the PCF8574 and the LCD pins and a particular backlight circuit.
```
P0 - RS
P1 - R/W
P2 - E
P3 - Backlight control (Active High)
P4 - DB4
P5 - DB5
P6 - DB6
P7 - DB7
```
Not all backpacks are wired up this way.
If the actual wiring or backlight circuit does not match what the library expects, the examples will not work.
Also, the examples must be modified to set the i2c address to match the i2c address of the PCF8574 chip.<br>
**If the address in the sketch does not match the actual address of the chip, the example will not work**.
The advantage of using hd44780 library and the hd44780_I2Cexp i/o class is that unlinke the LiquidCrystal_I2C library the hd44780 library will automatically determine the i2c address, pin wiring, and backlight control configuration.

View File

@@ -0,0 +1,39 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for LiquidCrystal_I2C library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// declare the lcd object
// Note: The i2c address must match the backpack address
// and the library only works with certain backpacks
const uint8_t i2cAddr = 0x27;
#define LCD_COLS 16
#define LCD_ROWS 2
LiquidCrystal_I2C lcd(i2cAddr, LCD_COLS, LCD_ROWS);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,46 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for LiquidCrystal_I2C library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
#if ARDUINO < 157
#error "This sketch Requires Arduino 1.5.7 or higher"
#endif
// NOTE: uses API that only works on IDE 1.5.7 and up
#define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate
// declare the lcd object
// Note: The i2c address must match the backpack address
// and the library only works with certain backpacks
const uint8_t i2cAddr = 0x27;
#define LCD_COLS 16
#define LCD_ROWS 2
LiquidCrystal_I2C lcd(i2cAddr, LCD_COLS, LCD_ROWS);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,24 @@
LiquidCrystal_PCF8574 hd44780 examples
=======================================
These examples require that the LiquidCrystal_PCF8574 library be installed.
LiquidCrystal_PCF8574 library can be installed using the IDE library manager.
It controls the LCD using an PCF8574 i/o expander backpack.
The library assumes a paticular wiring between the PCF8574 and the LCD pins and a particular backlight circuit.
```
P0 - RS
P1 - R/W
P2 - E
P3 - Backlight control (Active High)
P4 - DB4
P5 - DB5
P6 - DB6
P7 - DB7
```
Not all backpacks are wired up this way.
If the actual wiring or backlight circuit does not match what the library expects, the examples will not work.
Also, the examples must be modified to set the i2c address to match the i2c address of the PCF8574 chip.<br>
**If the address in the sketch does not match the actual address of the chip, the example will not work**.
The advantage of using hd44780 library and the hd44780_I2Cexp i/o class is that unlinke the LiquidCrystal_PCF8574 library the hd44780 library will automatically determine the i2c address, pin wiring, and backlight control configuration.

View File

@@ -0,0 +1,50 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for LiquidCrystal_PCF8574 library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address must match the backpack address
// and the library only works with certain backpacks
const uint8_t i2cAddr = 0x27;
LiquidCrystal_PCF8574 lcd(i2cAddr);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// tell lcd hd44780 sketch to call custom customLCDinit() for initialization
#define LCDISPEED_CALL_CUSTOM_LCDINIT
// have to use custom initialzation for this library
void custom_LCDinit(void)
{
lcd.begin(LCD_COLS, LCD_ROWS);
lcd.setBacklight(0xff);
}
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,57 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for LiquidCrystal_PCF8574 library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
#if ARDUINO < 157
#error "This sketch Requires Arduino 1.5.7 or higher"
#endif
// NOTE: uses API that only works on IDE 1.5.7 and up
#define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address must match the backpack address
// and the library only works with certain backpacks
const uint8_t i2cAddr = 0x27;
LiquidCrystal_PCF8574 lcd(i2cAddr);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// tell lcd hd44780 sketch to call custom customLCDinit() for initialization
#define LCDISPEED_CALL_CUSTOM_LCDINIT
// have to use custom initialzation for this library
void custom_LCDinit(void)
{
lcd.begin(LCD_COLS, LCD_ROWS);
lcd.setBacklight(0xff);
}
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,50 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in the hd44780 examples.
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
// include LCD.h which is only in newLiquidCrystal
// to force the IDE include path to use newLiquidCrystal instead
// of LiquidCrystal
// This works because even if the LiquidCrystal.h below causes the IDE to
// add the bundled LiquidCrystal library for it, since the LCD.h will have
// gotten the IDE to add the newLiquidCrystal library directory to the path
// first.
//
#include <LCD.h>
#include <LiquidCrystal.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare Arduino pins used for LCD functions
// and the lcd object
//const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // pins used by IDE LiquidCrystal examples
const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins
LiquidCrystal lcd(rs, en, db4, db5, db6, db7);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,44 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test: NewLiquidCrystal with LiquidCrystal_I2C
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address and pin mappings must match the backpack
// The pin mapping selected matches the "LiquidCrystal_I2C" library
// in the IDE library manager.
const uint8_t i2cAddr = 0x27;
const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3;
typeof(POSITIVE) blpol=POSITIVE; // backlight polarity level
LiquidCrystal_I2C lcd(i2cAddr, en, rw, rs, db4, db5, db6, db7, bl, blpol);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,51 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test: NewLiquidCrystal with LiquidCrystal_I2C
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
// ugliness to allow this sketch to locate the hd44780 example sketch
// note: hd44780.h is not needed, it is only included to get its directory on the include path
#include <hd44780.h>
#undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used.
#if ARDUINO < 157
#error "This sketch Requires Arduino 1.5.7 or higher"
#endif
// NOTE: uses API that only works on IDE 1.5.7 and up
#define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate
// cols and rows don't have to be exact to still get accurate transfer numbers
#define LCD_COLS 16
#define LCD_ROWS 2
// declare the lcd object
// Note: The i2c address and pin mappings must match the backpack
// The pin mapping selected matches the "LiquidCrystal_I2C" library
// in the IDE library manager.
const uint8_t i2cAddr = 0x27;
const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3;
typeof(POSITIVE) blpol=POSITIVE; // backlight polarity level
LiquidCrystal_I2C lcd(i2cAddr, en, rw, rs, db4, db5, db6, db7, bl, blpol);
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,14 @@
NewLiquidCrystal hd44780 examples
=================================
fm's NewLiquidCrystal library must be installed in order to use these sketches.<br>
The NewliquidCrystal library contains multiple i/o classes.
#### The examples are broken up into various sub directories for each i/o class
* `LiquidCrystal`<br>
Contains example sketches that are for LCDs that are wired up directly to Arduino pins.
* `LiquidCrystal_I2C`<br>
Contains example sketches that are for LCDs connected to a backpack using the i2c PCF8574 i/o expander chip to control the LCD.

View File

@@ -0,0 +1,9 @@
OtherLibraries
==============
This directory contains subdirectories for other (non hd44780) libraries that contain wrapper sketches for various hd44780examples sketches.
The hd44780examples directory under each subdirectory contains
library and i/o class specific wrapper sketches for various sketches under
examples/hd44780examples.
This is intended to allow easy benchmarking of the other libraries for comparison purposes.

View File

@@ -0,0 +1,22 @@
SoftwareWire hd44780 examples
==================================
These examples require that the SoftwareWire library be installed.
The SoftwareWire library can be installed using the IDE library manager.
SoftwareWire provides a Wire compatable library that allows the user to
configure pins for the SDA and SCL signals.
While it offers additional flexibility, it will not be as fast as using the
dedicated i2c h/w inside the microcontroller.
These examples use the hd44780 library hd44780_I2Cexp i/o class using
SoftwareWire instead of the Wire library.
Note: using a software Wire library is not necessary on the esp8266 platform as the wire library on that platform already provides a mechanims to change the pins used for i2c.
WARNING:
The SoftWareWire developers made a major change to the library June 2018
which is in the subsequent 1.5.1 release that causes it be unusable by
the hd44780 library.
Until this change is backed out, you will not be able to use
SoftWareWire beyond version 1.5.0 with the hd44780 library.

View File

@@ -0,0 +1,38 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for hd44780 hd44780_I2Cexp i/o class
// using SoftwareWire instead of Wire
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <SoftwareWire.h>
// Check for "new" SoftwareWire that breaks things
#if defined(TwoWire_h)
#error incompatible version of SoftwareWire library (use version 1.5.0)
#endif
const int sda=SDA, scl=SCL; // use same pins as h/w i2c
SoftwareWire Wire(sda,scl);
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header
// declare the lcd object
hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>

View File

@@ -0,0 +1,45 @@
// ----------------------------------------------------------------------------
// LCDiSpeed - LCD Interface Speed test for hd44780 hd44780_I2Cexp i/o class
// using SoftwareWire instead of Wire
// ----------------------------------------------------------------------------
// This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed.
// Note:
// This is not a normal sketch and should not be used as model or example
// of hd44780 library sketches.
// This sketch is simple wrapper that declares the needed lcd object for the
// hd44780 library sketch.
// It is provided as a convenient way to run a pre-configured sketch for
// the i/o class.
// The source code for this sketch lives in hd44780 examples:
// hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino
// From IDE:
// [File]->Examples-> hd44780/hd44780examples/LCDiSpeed
//
#include <SoftwareWire.h>
// Check for "new" SoftwareWire that breaks things
#if defined(TwoWire_h)
#error incompatible version of SoftwareWire library (use version 1.5.0)
#endif
const int sda=SDA, scl=SCL; // use same pins as h/w i2c
SoftwareWire Wire(sda,scl);
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header
#if ARDUINO < 157
#error "This sketch Requires Arduino 1.5.7 or higher"
#endif
// NOTE: uses API that only works on IDE 1.5.7 and up
#define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate
// declare the lcd object
hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins
// tell the hd44780 sketch the lcd object has been declared
#define HD44780_LCDOBJECT
// include the hd44780 library LCDiSpeed sketch source code
#include <examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino>