first commit
This commit is contained in:
@@ -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.
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user