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