├── README.md ├── examples ├── Documentation │ ├── Documentation.ino │ ├── README.md │ └── docs │ │ ├── README.html │ │ └── readme.txt ├── README.md ├── hd44780examples │ ├── LCD4Linux │ │ └── readme.txt │ ├── LCDcharset │ │ └── LCDcharset.ino │ ├── LCDiSpeed │ │ └── LCDiSpeed.ino │ ├── LCDlibTest │ │ └── LCDlibTest.ino │ ├── README.md │ ├── hd44780examples.ino │ └── lcdproc │ │ └── lcdproc.ino ├── ioClass │ ├── README.md │ ├── hd44780_HC1627_I2C │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── LCDCustomChars │ │ │ └── LCDCustomChars.ino │ │ ├── LineWrap │ │ │ └── LineWrap.ino │ │ ├── README.md │ │ ├── Serial2LCD │ │ │ └── Serial2LCD.ino │ │ ├── UpTime │ │ │ └── UpTime.ino │ │ └── hd44780examples │ │ │ ├── LCDcharset │ │ │ └── LCDcharset.ino │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ ├── LCDiSpeed400 │ │ │ └── LCDiSpeed400.ino │ │ │ ├── LCDlibTest │ │ │ └── LCDlibTest.ino │ │ │ ├── LCDlibTest400 │ │ │ └── LCDlibTest400.ino │ │ │ ├── lcdproc │ │ │ └── lcdproc.ino │ │ │ └── lcdproc400 │ │ │ └── lcdproc400.ino │ ├── hd44780_I2Cexp │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── I2CexpDiag │ │ │ └── I2CexpDiag.ino │ │ ├── LCDCustomChars │ │ │ └── LCDCustomChars.ino │ │ ├── LineWrap │ │ │ └── LineWrap.ino │ │ ├── MultiDisplay │ │ │ └── MultiDisplay.ino │ │ ├── README.md │ │ ├── ReadWrite │ │ │ └── ReadWrite.ino │ │ ├── Serial2LCD │ │ │ └── Serial2LCD.ino │ │ ├── SoftwareWire │ │ │ └── SoftwareWire.ino │ │ ├── UpTime │ │ │ └── UpTime.ino │ │ └── hd44780examples │ │ │ ├── LCDcharset │ │ │ └── LCDcharset.ino │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ ├── LCDiSpeed400 │ │ │ └── LCDiSpeed400.ino │ │ │ ├── LCDlibTest │ │ │ └── LCDlibTest.ino │ │ │ ├── LCDlibTest400 │ │ │ └── LCDlibTest400.ino │ │ │ ├── lcdproc │ │ │ └── lcdproc.ino │ │ │ └── lcdproc400 │ │ │ └── lcdproc400.ino │ ├── hd44780_I2Clcd │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── LCDCustomChars │ │ │ └── LCDCustomChars.ino │ │ ├── LineWrap │ │ │ └── LineWrap.ino │ │ ├── README.md │ │ ├── Serial2LCD │ │ │ └── Serial2LCD.ino │ │ ├── UpTime │ │ │ └── UpTime.ino │ │ └── hd44780examples │ │ │ ├── LCDcharset │ │ │ └── LCDcharset.ino │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ ├── LCDiSpeed400 │ │ │ └── LCDiSpeed400.ino │ │ │ ├── LCDlibTest │ │ │ └── LCDlibTest.ino │ │ │ ├── LCDlibTest400 │ │ │ └── LCDlibTest400.ino │ │ │ ├── lcdproc │ │ │ └── lcdproc.ino │ │ │ └── lcdproc400 │ │ │ └── lcdproc400.ino │ ├── hd44780_NTCU165ECPB │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── LCDCustomChars │ │ │ └── LCDCustomChars.ino │ │ ├── LineWrap │ │ │ └── LineWrap.ino │ │ ├── README.md │ │ ├── Serial2LCD │ │ │ └── Serial2LCD.ino │ │ ├── UpTime │ │ │ └── UpTime.ino │ │ └── hd44780examples │ │ │ ├── LCDcharset │ │ │ └── LCDcharset.ino │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ └── LCDlibTest │ │ │ └── LCDlibTest.ino │ ├── hd44780_NTCU20025ECPB_pinIO │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── LCDCustomChars │ │ │ └── LCDCustomChars.ino │ │ ├── LineWrap │ │ │ └── LineWrap.ino │ │ ├── README.md │ │ ├── ReadWrite │ │ │ └── ReadWrite.ino │ │ ├── Serial2LCD │ │ │ └── Serial2LCD.ino │ │ ├── UpTime │ │ │ └── UpTime.ino │ │ └── hd44780examples │ │ │ ├── LCDcharset │ │ │ └── LCDcharset.ino │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ ├── LCDlibTest │ │ │ └── LCDlibTest.ino │ │ │ └── lcdproc │ │ │ └── lcdproc.ino │ ├── hd44780_NTCUUserial │ │ ├── HelloWorld │ │ │ └── HelloWorld.ino │ │ ├── LCDCustomChars │ │ │ └── LCDCustomChars.ino │ │ ├── LineWrap │ │ │ └── LineWrap.ino │ │ ├── README.md │ │ ├── ReadWrite │ │ │ └── ReadWrite.ino │ │ ├── Serial2LCD │ │ │ └── Serial2LCD.ino │ │ ├── UpTime │ │ │ └── UpTime.ino │ │ └── hd44780examples │ │ │ ├── LCDcharset │ │ │ └── LCDcharset.ino │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ ├── LCDlibTest │ │ │ └── LCDlibTest.ino │ │ │ └── lcdproc │ │ │ └── lcdproc.ino │ └── hd44780_pinIO │ │ ├── HelloWorld │ │ └── HelloWorld.ino │ │ ├── LCDCustomChars │ │ └── LCDCustomChars.ino │ │ ├── LCDKeypadCheck │ │ └── LCDKeypadCheck.ino │ │ ├── LineWrap │ │ └── LineWrap.ino │ │ ├── README.md │ │ ├── ReadWrite │ │ └── ReadWrite.ino │ │ ├── Serial2LCD │ │ └── Serial2LCD.ino │ │ ├── UpTime │ │ └── UpTime.ino │ │ └── hd44780examples │ │ ├── LCDcharset │ │ └── LCDcharset.ino │ │ ├── LCDiSpeed │ │ └── LCDiSpeed.ino │ │ ├── LCDlibTest │ │ └── LCDlibTest.ino │ │ └── lcdproc │ │ └── lcdproc.ino └── otherLibraries │ ├── Adafruit_LiquidCrystal │ ├── 4bit │ │ └── hd44780examples │ │ │ └── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ ├── I2C │ │ └── hd44780examples │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ └── LCDiSpeed400 │ │ │ └── LCDiSpeed400.ino │ ├── README.md │ └── SPI │ │ └── hd44780examples │ │ └── LCDiSpeed │ │ └── LCDiSpeed.ino │ ├── LiquidCrystal │ ├── README.md │ └── hd44780examples │ │ └── LCDiSpeed │ │ └── LCDiSpeed.ino │ ├── LiquidCrystalFast │ ├── LiquidCrystalFastRW │ │ └── hd44780examples │ │ │ └── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ ├── LiquidCrystalFastnoRW │ │ └── hd44780examples │ │ │ └── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ └── README.md │ ├── LiquidCrystalIO │ ├── README.md │ ├── ioFrom8574 │ │ └── hd44780examples │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ └── LCDiSpeed400 │ │ │ └── LCDiSpeed400.ino │ └── ioUsingArduino │ │ └── hd44780examples │ │ └── LCDiSpeed │ │ └── LCDiSpeed.ino │ ├── LiquidCrystal_I2C │ ├── README.md │ └── hd44780examples │ │ ├── LCDiSpeed │ │ └── LCDiSpeed.ino │ │ └── LCDiSpeed400 │ │ └── LCDiSpeed400.ino │ ├── LiquidCrystal_PCF8574 │ ├── README.md │ └── hd44780examples │ │ ├── LCDiSpeed │ │ └── LCDiSpeed.ino │ │ └── LCDiSpeed400 │ │ └── LCDiSpeed400.ino │ ├── NewLiquidCrystal │ ├── LiquidCrystal │ │ └── hd44780examples │ │ │ └── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ ├── LiquidCrystal_I2C │ │ └── hd44780examples │ │ │ ├── LCDiSpeed │ │ │ └── LCDiSpeed.ino │ │ │ └── LCDiSpeed400 │ │ │ └── LCDiSpeed400.ino │ └── README.md │ ├── README.md │ └── SoftwareWire │ ├── README.md │ └── hd44780examples │ ├── LCDiSpeed │ └── LCDiSpeed.ino │ └── LCDiSpeed400 │ └── LCDiSpeed400.ino ├── extras └── buildtools │ ├── mkChangeLog │ ├── mkrelease │ ├── mkreleasePatcher │ ├── mkreleasePostPatcher │ └── readme.txt ├── hd44780.cpp ├── hd44780.h ├── hd44780ioClass ├── README.md ├── hd44780_HC1627_I2C.h ├── hd44780_I2Cexp.h ├── hd44780_I2Clcd.h ├── hd44780_NTCU165ECPB.h ├── hd44780_NTCU20025ECPB_pinIO.h ├── hd44780_NTCUUserial.h └── hd44780_pinIO.h ├── keywords.txt ├── library.properties ├── license.txt └── licenseInfo.txt /examples/Documentation/README.md: -------------------------------------------------------------------------------- 1 | Documenation sketch 2 | =================== 3 | The Documenation.ino sketch is not really an example sketch. 4 | It is a dummy sketch used to allow documentation to be accessed through the IDE when the sketched is loaded into the IDE. 5 | -------------------------------------------------------------------------------- /examples/Documentation/docs/readme.txt: -------------------------------------------------------------------------------- 1 | documenation will be placed here 2 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | hd44780 examples 2 | ================ 3 | The hd44780 library package inclues many examples that demonstrate the capabilities of the library. 4 | 5 | #### The examples are broken up into various sub directories. 6 | 7 | * `Documenatation`
8 | The Documenation sketch is not really an example sketch. 9 | It is a dummy sketch used to allow documentation to be accessed through the IDE when the sketched is loaded into the IDE. 10 | 11 | * `ioClass`
12 | Contains subdirectories for each included hd44780 i/o class containing example sketches 13 | that are specific to the i/o class. They also contain wrapper sketches for the special purpose sketches mentioned above. 14 | 15 | * `otherLibraries`
16 | Contains subdirectories for other (non hd44780) libraries that contain wrapper sketches for various special purpose hd44780examples sketches. 17 | Its primary purpose is to provide easy benchmarking of other libraries for comparison purposes by using LCDiSpeed. 18 | 19 | **The sketches in the hd44780examples area are special purpose sketches that are used as include files for the i/o class examples. 20 | They should not be looked at as examples for how to use the library.** 21 | While the hd44780examples sketches can be modified to work standalone with any LiquidCrystal API compatible library, their primary purpose, as shipped in the hd44780 library package, is to act as an include file for the i/o class wrapper sketches and are not intended to be used directly. 22 | **See the ioClass specific subdirectories for the examples for each ioClass.** 23 | -------------------------------------------------------------------------------- /examples/hd44780examples/LCD4Linux/readme.txt: -------------------------------------------------------------------------------- 1 | https://lcd4linux.bulix.org/ 2 | https://lcd4linux.bulix.org/wiki/Displays 3 | https://github.com/ZivaVatra/ArduLCD 4 | -------------------------------------------------------------------------------- /examples/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | static const int dummyvar = 0; // dummy declaration for older broken IDEs!!!! 2 | // vi:ts=4 3 | // ---------------------------------------------------------------------------- 4 | // LCDcharset - simple demonstration to show character set font in LCD 5 | // Created by Bill Perry 2018-01-06 6 | // bperrybap@opensource.billsworld.billandterrie.com 7 | // 8 | // This example code is unlicensed and is released into the public domain 9 | // ---------------------------------------------------------------------------- 10 | // 11 | // sketch displays the character for all the character codes 0x00 to 0xff 12 | // miniture digits are assigned to the custom character codepoints corresponding 13 | // to the codepoint value. i.e. 14 | // codepoint 0 is assigned miniture '0' character. 15 | // codepoint 1 is assigned miniture '1' character. etc... 16 | // 17 | // ---------------------------------------------------------------------------- 18 | // History 19 | // 2018.01.06 bperrybap - Original creation 20 | // 21 | // @author Bill Perry - bperrybap@opensource.billsworld.billandterrie.com 22 | // --------------------------------------------------------------------------- 23 | 24 | #ifndef HD44780_LCDOBJECT 25 | 26 | #error "Special purpose sketch: Use i/o class example wrapper sketch instead." 27 | 28 | /* 29 | * If not using a hd44780 library i/o class example wrapper sketch, 30 | * you must modify the sketch to include any needed header files for the 31 | * intended library and define the lcd object. 32 | * 33 | * Add your includes and constructor. 34 | * The lcd object must be named "lcd" 35 | * and comment out the #error message. 36 | */ 37 | 38 | #endif 39 | 40 | // ============================================================================ 41 | // user configurable options below this point 42 | // ============================================================================ 43 | 44 | 45 | /* 46 | * Define LCD size 47 | * 16x2 will work ok on larger displays but if you want the frame rate 48 | * for the full LCD geometry, define that here 49 | * Note: these can be (and are) overridden by defines in a wrapper sketch. 50 | */ 51 | #ifndef LCD_COLS 52 | #define LCD_COLS 16 53 | #endif 54 | 55 | #ifndef LCD_ROWS 56 | #define LCD_ROWS 2 57 | #endif 58 | 59 | 60 | // minature digits 61 | // To be used for the Custom characters 62 | const PROGMEM uint8_t minidigit[10][8] = { 63 | {0x07,0x05,0x05,0x05,0x07,0x00,0x00,0x00}, // minature 0 64 | {0x02,0x06,0x02,0x02,0x07,0x00,0x00,0x00}, // minature 1 65 | {0x03,0x05,0x02,0x04,0x07,0x00,0x00,0x00}, // minature 2 66 | {0x07,0x01,0x07,0x01,0x07,0x00,0x00,0x00}, // minature 3 67 | {0x05,0x05,0x07,0x01,0x01,0x00,0x00,0x00}, // minature 4 68 | {0x07,0x04,0x06,0x01,0x07,0x00,0x00,0x00}, // minature 5 69 | {0x07,0x04,0x07,0x05,0x07,0x00,0x00,0x00}, // minature 6 70 | {0x07,0x01,0x02,0x04,0x04,0x00,0x00,0x00}, // minature 7 71 | {0x07,0x05,0x07,0x05,0x07,0x00,0x00,0x00}, // minature 8 72 | {0x07,0x05,0x07,0x01,0x01,0x00,0x00,0x00}, // minature 9 73 | }; 74 | 75 | 76 | void setup() 77 | { 78 | int status; 79 | 80 | // initialize LCD with number of columns and rows: 81 | // hd44780 returns a status from begin() that can be used 82 | // to determine if initalization failed. 83 | // the actual status codes are defined in 84 | // See the values RV_XXXX 85 | // 86 | // looking at the return status from begin() is optional 87 | // it is being done here to provide feedback should there be an issue 88 | // 89 | // note: 90 | // begin() will automatically turn on the backlight 91 | // 92 | status = lcd.begin(LCD_COLS, LCD_ROWS); 93 | if(status) // non zero status means it was unsuccesful 94 | { 95 | status = -status; // convert negative status value to positive number 96 | 97 | // begin() failed so blink error code using the onboard LED if possible 98 | hd44780::fatalError(status); // does not return 99 | } 100 | 101 | // initalization was successful, the backlight should be on now 102 | if(LCD_COLS > 8) 103 | lcd.print("LCD "); 104 | 105 | lcd.print("Charset"); 106 | 107 | // Fill in the 8 custom characters with miniture digits 108 | // so they can be seen in the character set 109 | for(uint8_t i=0; i < 8; i++) 110 | lcd.createChar(i, minidigit[i]); // mini digit matching each codepoint 111 | 112 | delay(2000); 113 | } 114 | void loop(void) 115 | { 116 | static int c = 0; 117 | 118 | lcd.clear(); 119 | if(LCD_COLS>15) 120 | lcd.print("Codes 0"); 121 | lcd.print("x"); 122 | lcd.print(c, HEX); 123 | lcd.print("-0x"); lcd.print(c+LCD_COLS-1, HEX); 124 | 125 | if(LCD_ROWS > 1) 126 | { 127 | lcd.setCursor(0, 1); 128 | for(int col = 0; col < LCD_COLS; col++) 129 | lcd.write(' '); 130 | lcd.setCursor(0, 1); 131 | } 132 | else 133 | { 134 | delay(2000); 135 | lcd.clear(); 136 | } 137 | 138 | 139 | for(int j=0; j 255) 143 | { 144 | c = 0; 145 | break; 146 | } 147 | } 148 | delay(4000); 149 | 150 | } 151 | -------------------------------------------------------------------------------- /examples/hd44780examples/README.md: -------------------------------------------------------------------------------- 1 | hd44780examples 2 | =============== 3 | 4 | The examples in this directory are not really example sketches.
5 | **They should not be looked at as examples for how to use the library.**
6 | They are special purpose sketches that are used as include files for the i/o class examples. 7 | These sketches allow using a "wrapper sketch" to define the lcd object 8 | and lcd geometry which then includes the hd44780 example sketch as an 9 | alternative to having to edit the actual sketch. 10 | While these sketches can be modified to work standalone with any LiquidCrystal API compatible library, their primary purpose, as shipped in the hd44780 library package, is to act as an include file for the i/o class wrapper sketches and are not intended to be used directly. 11 | **See the ioClass specific subdirectories for the examples for each ioClass.** 12 | 13 | #### The following special purpose sketches are provided: 14 | - `LCDcharset`
15 | Shows the entire character set of the LCD. 16 | Miniture digits are used to show the custom characters. 17 | 18 | - `LCDisSpeed`
19 | Shows the speed of writing characters to the display. 20 | It shows the transfer time of an individual character as well as updating 21 | the full display. If the geometry is different than 16x2 it will also show what the full display timing would be if the display were 16x2. 22 | Since the sketch can work on many different libraries and h/w, it is useful for ccomparing the speed of various libraries and LCD h/w. 23 | 24 | - `LCDlibTest`
25 | Tests various API functions and LCD capabilities 26 | Diagnostic information is also sent to the serial port. 27 | Its primary purpose is for internal library testing & verficiation. 28 | 29 | - `lcdproc`
30 | Allows using a hd44780 LCD display with the linux/unix 31 | lcdproc system. See the sketch for more details. 32 | -------------------------------------------------------------------------------- /examples/hd44780examples/hd44780examples.ino: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // hd44780 Extensible hd44780 LCD Library 3 | // 4 | // hd44780 is an open source project for open source projects. Those wishing to 5 | // create closed projects should seek an alternate solution. 6 | // hd44780 is licensed under the terms of the GNU General Public License v3.0 7 | // as opposed to the more liberal licensing terms of the 8 | // GNU Lesser General Public License (LGPL), MIT, modified BSD, Apache, etc.. 9 | // 10 | // GPL licensing information can found here: https://www.gnu.org/licenses/ 11 | /////////////////////////////////////////////////////////////////////////////// 12 | // 13 | // Overview 14 | // ======== 15 | // The hd44780 arduino library is a library package. 16 | // It is more than a simple library to run a specific h/w. 17 | // It is actually an expandable library package that can communicate with 18 | // many different types of LCD hardware and interfaces. 19 | // 20 | // The library is designed to allow communication and interfacing with hd44780 21 | // LCDs over a variety of h/w interfaces. 22 | // Each h/w communication interface has its own C++ i/o class. 23 | // 24 | // The library currently comes with the following i/o subclasses: 25 | // 26 | // hd44780_pinIO: control LCD using direct Arduino Pin connections 27 | // hd44780_I2Cexp: control LCD using i2c i/o exapander backpack (PCF8574 or MCP23008) 28 | // hd44780_I2Clcd: control LCD with native i2c interface (PCF2116, PCF2119x, etc...) 29 | // hd44780_NTCU165ECPB: control Noritake CU165ECBP-T2J LCD display over SPI 30 | // hd44780_NTCUUserial: control Noritake CU-U Series VFD display in serial mode 31 | // 32 | // Examples 33 | // ======== 34 | // Because the hd44780 library package is more than a simple library, the 35 | // examples are not all together in a single location. 36 | // The examples are seperated and grouped in to areas as follows: 37 | // 38 | // ioClass: 39 | // All the hd44780 library package examples are under here. 40 | // ioClass contains subdirectories for each included hd44780 i/o class 41 | // containing sketches that are specific to the i/o class. 42 | // The examples for each i/o class are grouped together in a directory by 43 | // the name of the i/o class. 44 | // In the Arduino IDE they can be found here: 45 | // [File]->Examples->hd44780->ioClass 46 | // For example, the examples for the hd44780_I2Cexp i/o class will be 47 | // found here: 48 | // [File]->Examples->hd44780->ioClass->hd44780_I2Cexp 49 | // 50 | // otherLibraries: 51 | // Contains subdirectories for other (non hd44780) libraries that contain 52 | // wrapper sketches for various hd44780examples sketches. This is intended 53 | // to allow easy benchmarking of other 3rd party LCD libraries for 54 | // comparison purposes. 55 | // 56 | // See the Documentation sketch for additional information. 57 | // 58 | // Note: 59 | // The library package also includes some special purpose demonstration 60 | // sketches that can be found under ioClass and otherLibraries 61 | // - LCDcharset 62 | // Shows the entire character set of the LCD. 63 | // Miniture digits are used to show the custom characters. 64 | // 65 | // - LCDisSpeed 66 | // Shows the speed of writing characters to the display. 67 | // It shows the transfer time of an individual character as well as 68 | // updating the full display. If the geometry is different than 16x2, 69 | // it will also show what the full display timing would be if the 70 | // display were 16x2. 71 | // 72 | // Since the sketch can work on many different libraries and h/w, 73 | // it is useful for ccomparing the speed of various libraries and LCD h/w. 74 | // 75 | ///////////////////////////////////////////////////////////////////////// 76 | 77 | 78 | // dummy sketch functions 79 | void setup(void){} 80 | void loop(void){} 81 | -------------------------------------------------------------------------------- /examples/hd44780examples/lcdproc/lcdproc.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ----------------------------------------------------------------------- 3 | // lcdproc hd44780 serial device 4 | // 5 | // lcdproc is the linux equivilent of Windows LCD Smartie 6 | // Information on how to set this up and use it can be found here: 7 | // https://milesburton.com/USD_LCD_Display_(HD44780)_Running_on_Linux_via_Arduino 8 | // http://lcdproc.omnipotent.net/ 9 | // 10 | // This sketch implments a serial hd44780 interface device which can be 11 | // used by lcdproc 12 | // This code should work with any LiquidCrystal compatible library. 13 | // 14 | // While you can modify this sketch to use any "LiquidCrystal" library 15 | // and modify the default lcd parametes, 16 | // wrapper sketches are included in the hd44780 i/o libraries that 17 | // declare the lcd object and the needed defines to do this for you. 18 | // ----------------------------------------------------------------------- 19 | 20 | #ifndef HD44780_LCDOBJECT 21 | 22 | #error "Special purpose sketch: Use i/o class example wrapper sketch instead." 23 | 24 | /* 25 | * If not using a hd44780 library i/o class example wrapper sketch, 26 | * you must modify the sketch to include any needed header files for the 27 | * intended library and define the lcd object. 28 | * 29 | * Add your includes and constructor. 30 | * The lcd object must be named "lcd" 31 | * and comment out the #error message. 32 | */ 33 | 34 | #endif 35 | /* 36 | * Define your LCD parameters 37 | * These must match what you configured in LCDd.conf on the linux host 38 | */ 39 | #ifndef LCD_COLS 40 | #define LCD_COLS 20 41 | #endif 42 | 43 | #ifndef LCD_ROWS 44 | #define LCD_ROWS 4 45 | #endif 46 | 47 | #ifndef BAUDRATE 48 | #define BAUDRATE 9600 49 | #endif 50 | 51 | void setup() 52 | { 53 | Serial.begin(BAUDRATE); 54 | // set up the LCD's number of columns and columns: 55 | lcd.begin(LCD_COLS, LCD_ROWS); 56 | 57 | #ifdef WIRECLOCK 58 | #if (ARDUINO > 10507) && !defined(MPIDE) 59 | Wire.setClock(WIRECLOCK); // set i2c clock bit rate, if asked 60 | #endif 61 | #endif 62 | 63 | lcd.clear(); 64 | // print out a banner that indicates lcd proc device 65 | // and pramameters like baudrate and geometry 66 | lcd.print("LCD Proc:"); 67 | lcd.print("hd44780"); 68 | lcd.setCursor(0,1); 69 | lcd.print(BAUDRATE); 70 | lcd.print(' '); 71 | lcd.print(LCD_COLS); 72 | lcd.print('x'); 73 | lcd.print(LCD_ROWS); 74 | delay(1000); 75 | } 76 | 77 | uint8_t serial_getch() 78 | { 79 | int incoming; 80 | 81 | while (!Serial.available()){ } 82 | // read the incoming byte: 83 | incoming = Serial.read(); 84 | 85 | return (incoming & 0xff); 86 | } 87 | 88 | void loop() 89 | { 90 | uint8_t rxbyte; 91 | 92 | rxbyte = serial_getch(); // Fetch byte 93 | 94 | if(rxbyte==0xFE) // If command 95 | lcd.command(serial_getch()); // Pass through raw hd44780 command 96 | else 97 | lcd.write(rxbyte); //Otherwise send it as text character 98 | } 99 | -------------------------------------------------------------------------------- /examples/ioClass/README.md: -------------------------------------------------------------------------------- 1 | ioClass 2 | ======= 3 | 4 | This directory contains a subdirectory for each i/o class that contains 5 | examples for that specific i/o class. 6 | 7 | The hd44780examples directory under each i/o class subdirectory contains 8 | i/o class specific wrapper sketches for the special purpose sketches under 9 | examples/hd44780examples. 10 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // HelloWorld - simple demonstration of lcd 4 | // Created by Bill Perry 2020-06-26 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCD devices like the Tsingtek Display HC1627 modules 11 | // in i2c mode. Devices such as HC1627-B-LWH-I2C-30 or HC1627-SYH-I2C-30 12 | // These devices have a native I2C interface rather than use a simple I2C 13 | // i/o expander chip such as a PCF8574 or MCP23008. 14 | // 15 | // NOTE: 16 | // These devices usually need external pullups as they typically are not on 17 | // the module. 18 | // WARNING: 19 | // Use caution when using 3v only processors like arm and ESP8266 processors 20 | // when interfacing with 5v modules as not doing proper level shifting or 21 | // incorrectly hooking things up can damage the processor. 22 | // 23 | // Sketch prints "Hello, World!" on the lcd 24 | // 25 | // If initialization of the LCD fails and the arduino supports a built in LED, 26 | // the sketch will simply blink the built in LED. 27 | // 28 | // ---------------------------------------------------------------------------- 29 | // While not all modules use the same pinout, 30 | // Be VERY careful and check your datasheet 31 | // 32 | // This pin table is for the Tsingtek Display HC1627-SYH-I2C-30 or 33 | // HC1627-SYH-I2C-30 module when it is strapped for i2c mode operation 34 | // 35 | // pin 14 is the pin closest to the edge of the PCB 36 | // 14 - connect to gnd 37 | // 13 - connect to vcc 38 | // 12 - ID0 --- controls bit 1 of 7 bit i2c address, strap accordingly 39 | // 11 - ID1 --- controls bit 2 of 7 bit i2c address, strap accordingly 40 | // 10 - not connected 41 | // 9 - not connected 42 | // 8 - SCL 43 | // 7 - SDA 44 | // 6 - connect to gnd 45 | // 5 - connect to gnd 46 | // 4 - connect to gnd 47 | // 3 - Vo Contrast Voltage input 48 | // 2 - VCC (5v) 49 | // 1 - LCD gnd 50 | // 15 - Backlight Anode (+5v) 51 | // 16 - Backlight Cathode (Gnd) 52 | // 53 | // I2C IDx address table 54 | // ID1 ID0 ADDR 55 | // L L 0x38/0x39 56 | // L H 0x3A/0x3B 57 | // H L 0x3C/0x3D 58 | // H H 0x3E/0x3F 59 | // 60 | // library only needs to know the base address (the lower address) 61 | // 62 | // ---------------------------------------------------------------------------- 63 | // LiquidCrystal compability: 64 | // Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal 65 | // sketches should work with hd44780 hd44780_HC1627_I2C i/o class once the 66 | // includes are changed to use hd44780 and the lcd object constructor is 67 | // changed to use the hd44780_HC1627_I2C i/o class. 68 | 69 | #include 70 | #include 71 | #include // i2c LCD i/o class header 72 | 73 | // Note, i2c address can be specified or automatically located 74 | // If you wish to use a specific address comment out this constructor 75 | // and use the constructor below that specifies the address 76 | 77 | // declare the lcd object for auto i2c address location 78 | hd44780_HC1627_I2C lcd; 79 | 80 | // 81 | // manually enter base address of LCD. 82 | // Base Addresses 83 | // - 0x38, 0x3A, 0x3C, or 0x3E 84 | 85 | // declare i2c address and constructor for specified i2c address 86 | //const int i2c_addr = 0x38; 87 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 88 | 89 | 90 | // LCD geometry 91 | const int LCD_COLS = 16; 92 | const int LCD_ROWS = 2; 93 | void setup() 94 | { 95 | int status; 96 | 97 | // initialize LCD with number of columns and rows: 98 | // hd44780 returns a status from begin() that can be used 99 | // to determine if initalization failed. 100 | // the actual status codes are defined in 101 | // See the values RV_XXXX 102 | // 103 | // looking at the return status from begin() is optional 104 | // it is being done here to provide feedback should there be an issue 105 | // 106 | status = lcd.begin(LCD_COLS, LCD_ROWS); 107 | if(status) // non zero status means it was unsuccesful 108 | { 109 | // begin() failed so blink error code using the onboard LED if possible 110 | hd44780::fatalError(status); // does not return 111 | } 112 | 113 | // Print a message to the LCD 114 | lcd.print("Hello, World!"); 115 | } 116 | 117 | void loop() {} 118 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/README.md: -------------------------------------------------------------------------------- 1 | hd44780_HC1627 examples 2 | ======================= 3 | 4 | The examples included in this directory are for the hd44780_HC1627 i/o class.
5 | The hd44780_HC1627 i/o class controls an LCD with a native i2c interface like the Tsingtek Display HC1627-SYH-I2C-30 6 | 7 | #### The following examples are included: 8 | 9 | - `HelloWorld`
10 | Prints "Hello, World!" on the lcd 11 | 12 | - `LCDCustomChars`
13 | Demonstrates using custom characters 14 | 15 | - `LineWrap`
16 | Demonstrates automatic linewrap functionality 17 | 18 | - `Serial2LCD`
19 | Displays a message read from the serial port on the lcd. 20 | 21 | - `UpTime`
22 | Prints the amount of time since the Arduino has been reset. 23 | 24 | - `hd44780examples`
25 | The hd44780examples subdirectory contains 26 | hd44780_HC1627 class specific wrapper sketches for sketches under 27 | examples/hd44780examples. 28 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDcharset - Display LCD character set 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDcharset. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDcharset/LCDcharset.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDcharset 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // define the LCD geometry 23 | #define LCD_COLS 16 24 | #define LCD_ROWS 2 25 | 26 | // declare the lcd object for auto i2c address location 27 | hd44780_HC1627_I2C lcd; 28 | 29 | // declare i2c address and constructor for specified i2c base address 30 | //const int i2c_addr = 0x3b; 31 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 32 | 33 | // tell the hd44780 sketch the lcd object has been declared 34 | #define HD44780_LCDOBJECT 35 | 36 | // include the hd44780 library LCDcharset sketch source code 37 | #include 38 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object for auto i2c address location 23 | hd44780_HC1627_I2C lcd; 24 | 25 | // declare i2c address and constructor for specified i2c base address 26 | //const int i2c_addr = 0x3b; 27 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 28 | 29 | // tell the hd44780 sketch the lcd object has been declared 30 | #define HD44780_LCDOBJECT 31 | 32 | // include the hd44780 library LCDiSpeed sketch source code 33 | #include 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object for auto i2c address location 30 | hd44780_HC1627_I2C lcd; 31 | 32 | // declare i2c address and constructor for specified i2c base address 33 | //const int i2c_addr = 0x3b; 34 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library LCDiSpeed sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/hd44780examples/LCDlibTest/LCDlibTest.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object for auto i2c address location 23 | hd44780_HC1627_I2C lcd; 24 | 25 | // declare i2c address and constructor for specified i2c base address 26 | //const int i2c_addr = 0x3b; 27 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 28 | 29 | // tell the hd44780 sketch the lcd object has been declared 30 | #define HD44780_LCDOBJECT 31 | 32 | // include the hd44780 library sketch source code 33 | #include 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/hd44780examples/LCDlibTest400/LCDlibTest400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object for auto i2c address location 30 | hd44780_HC1627_I2C lcd; 31 | 32 | // declare i2c address and constructor for specified i2c base address 33 | //const int i2c_addr = 0x3b; 34 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/hd44780examples/lcdproc/lcdproc.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object for auto i2c address location 23 | hd44780_HC1627_I2C lcd; 24 | 25 | // declare i2c address and constructor for specified i2c base address 26 | //const int i2c_addr = 0x3b; 27 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 28 | 29 | // tell the hd44780 sketch the lcd object has been declared 30 | #define HD44780_LCDOBJECT 31 | 32 | // include the hd44780 library sketch source code 33 | #include 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_HC1627_I2C/hd44780examples/lcdproc400/lcdproc400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object for auto i2c address location 30 | hd44780_HC1627_I2C lcd; 31 | 32 | // declare i2c address and constructor for specified i2c base address 33 | //const int i2c_addr = 0x3b; 34 | //hd44780_HC1627_I2C lcd(i2c_addr); // use device at this address 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // HelloWorld - simple demonstration of lcd 4 | // Created by Bill Perry 2016-07-02 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCDs with PCF8574 or MCP23008 chip based backpacks 11 | // WARNING: 12 | // Use caution when using 3v only processors like arm and ESP8266 processors 13 | // when interfacing with 5v modules as not doing proper level shifting or 14 | // incorrectly hooking things up can damage the processor. 15 | // 16 | // Sketch prints "Hello, World!" on the lcd 17 | // 18 | // If initialization of the LCD fails and the arduino supports a built in LED, 19 | // the sketch will simply blink the built in LED. 20 | // 21 | // NOTE: 22 | // If the sketch fails to produce the expected results, or blinks the LED, 23 | // run the included I2CexpDiag sketch to test the i2c signals and the LCD. 24 | // 25 | // ---------------------------------------------------------------------------- 26 | // LiquidCrystal compability: 27 | // Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal 28 | // sketches should work with hd44780 hd44780_I2Cexp i/o class once the 29 | // includes are changed to use hd44780 and the lcd object constructor is 30 | // changed to use the hd44780_I2Cexp i/o class. 31 | 32 | #include 33 | #include // main hd44780 header 34 | #include // i2c expander i/o class header 35 | 36 | hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip 37 | 38 | // If you wish to use an i/o expander at a specific address, you can specify the 39 | // i2c address and let the library auto configure it. If you don't specify 40 | // the address, or use an address of zero, the library will search for the 41 | // i2c address of the device. 42 | // hd44780_I2Cexp lcd(i2c_address); // specify a specific i2c address 43 | // 44 | // It is also possible to create multiple/seperate lcd objects 45 | // and the library can still automatically locate them. 46 | // Example: 47 | // hd4480_I2Cexp lcd1; 48 | // hd4480_I2Cexp lcd2; 49 | // The individual lcds would be referenced as lcd1 and lcd2 50 | // i.e. lcd1.home() or lcd2.clear() 51 | // 52 | // It is also possible to specify the i2c address 53 | // when declaring the lcd object. 54 | // Example: 55 | // hd44780_I2Cexp lcd1(0x20); 56 | // hd44780_I2Cexp lcd2(0x27); 57 | // This ensures that each each lcd object is assigned to a specific 58 | // lcd device rather than letting the library automatically asign it. 59 | 60 | // LCD geometry 61 | const int LCD_COLS = 16; 62 | const int LCD_ROWS = 2; 63 | 64 | void setup() 65 | { 66 | int status; 67 | 68 | // initialize LCD with number of columns and rows: 69 | // hd44780 returns a status from begin() that can be used 70 | // to determine if initalization failed. 71 | // the actual status codes are defined in 72 | // See the values RV_XXXX 73 | // 74 | // looking at the return status from begin() is optional 75 | // it is being done here to provide feedback should there be an issue 76 | // 77 | // note: 78 | // begin() will automatically turn on the backlight 79 | // 80 | status = lcd.begin(LCD_COLS, LCD_ROWS); 81 | if(status) // non zero status means it was unsuccesful 82 | { 83 | // hd44780 has a fatalError() routine that blinks an led if possible 84 | // begin() failed so blink error code using the onboard LED if possible 85 | hd44780::fatalError(status); // does not return 86 | } 87 | 88 | // initalization was successful, the backlight should be on now 89 | 90 | // Print a message to the LCD 91 | lcd.print("Hello, World!"); 92 | } 93 | 94 | void loop() {} 95 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/README.md: -------------------------------------------------------------------------------- 1 | hd44780_I2Cexp examples 2 | ======================= 3 | 4 | The examples included in this directory are for the hd44780_I2Cexp i/o class.
5 | The hd44780_I2Cexp i/o class controls an LCD using an i2c i/o exapander backpack (PCF8574 or MCP23008) 6 | 7 | 8 | #### The following examples are included: 9 | 10 | - `HelloWorld`
11 | Prints "Hello, World!" on the lcd 12 | 13 | - `I2CexpDiag`
14 | Verifies configuation & operation of hd44780 LCDs based 15 | on the Hitachi HD44780 and compatible chipsets using I2C extension 16 | backpacks that use a simple I2C i/o expander chip. (PCF8574 or MCP23008) 17 | Sketch supports testing of multiple displays at once. 18 | 19 | - `LCDCustomChars`
20 | Demonstrates using custom characters 21 | 22 | - `LineWrap`
23 | Demonstrates automatic linewrap functionality 24 | 25 | - `MultiDisplay`
26 | Displays information on multiple displays at once. 27 | 28 | - `ReadWrite`
29 | Demonstrates the ability to read data from the LCD. 30 | 31 | - `Serial2LCD`
32 | Displays a message read from the serial port on the lcd. 33 | 34 | - `SoftwareWire`
35 | Demonstrates how to use the SoftwareWire library to allow using different pins 36 | for SDA and SCL signals. 37 | 38 | - `UpTime`
39 | Prints the amount of time since the Arduino has been reset. 40 | 41 | - `hd44780examples`
42 | The hd44780examples subdirectory contains 43 | hd44780_I2Cexp class specific wrapper sketches for sketches under 44 | examples/hd44780examples. 45 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/ReadWrite/ReadWrite.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // ReadWrite - simple demonstration reading data from LCD 4 | // Created by Bill Perry 2016-08-19 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCDs with PCF8574 or MCP23008 chip based backpacks 11 | // WARNING: 12 | // Use caution when using 3v only processors like arm and ESP8266 processors 13 | // when interfacing with 5v modules as not doing proper level shifting or 14 | // incorrectly hooking things up can damage the processor. 15 | // 16 | // The purpose of the sketch is to demonstrate the ability to read data from 17 | // the LCD. 18 | // 19 | // Sketch will print the amount of time since the Arduino has been reset 20 | // on the top row and then read the data from the LCD to print it on the 21 | // second row 22 | // 23 | // If there are errors and the arduino supports a built in LED, 24 | // an error status code will blink on the built in LED. 25 | // Error codes: 26 | // (1) lcd device initalization failed 27 | // (2) lcd device does not support reads 28 | // (3) error reading data from lcd device 29 | // (4) error writing data to lcd device 30 | // (5) read data mismatch 31 | // 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip 38 | 39 | // LCD geometry 40 | const int LCD_ROWS = 2; 41 | const int LCD_COLS = 16; 42 | 43 | void setup() 44 | { 45 | // initialize LCD with number of columns and rows: 46 | if( lcd.begin(LCD_COLS, LCD_ROWS)) 47 | { 48 | // begin() failed so blink the onboard LED if possible 49 | fatalError(1); 50 | } 51 | 52 | // check to see if device can read by attempting to read 53 | // the lcd status register. If it fails then assume it was 54 | // because the lcd device does not support reads. 55 | if(lcd.status() < 0) 56 | { 57 | lcd.print("No Read Support"); 58 | fatalError(2); 59 | } 60 | } 61 | 62 | void loop() 63 | { 64 | static unsigned long lastsecs = -1; // pre-initialize with non zero value 65 | unsigned long secs; 66 | 67 | secs = millis() / 1000; 68 | 69 | // see if 1 second has passed 70 | // so the display is only updated once per second 71 | if(secs != lastsecs) 72 | { 73 | lastsecs = secs; // keep track of last seconds 74 | 75 | // set the cursor position to top line: column 0, row 0 76 | lcd.setCursor(0, 0); 77 | 78 | // print uptime on lcd device: (time since last reset) 79 | PrintUpTime(lcd, secs); 80 | 81 | // Now copy the characters from the top line to the 2nd line 82 | // This is done character by character by: 83 | // - setting the character position to read 84 | // - reading a character 85 | // - setting the character position to write 86 | // - writing the charcter read 87 | for(int col = 0; col < LCD_COLS; col++) 88 | { 89 | int c; 90 | 91 | lcd.setCursor(col, 0); 92 | if((c = lcd.read()) < 0) // if a read error, bomb out 93 | fatalError(3); 94 | 95 | // check for ':' characters in col 2 and 5 96 | // if not there, consider it a fatal read error 97 | if((col == 2 || col == 5) && c != ':') 98 | fatalError(5); 99 | 100 | lcd.setCursor(col, 1); 101 | if(lcd.write((uint8_t) c) != 1) 102 | fatalError(4); 103 | } 104 | } 105 | } 106 | 107 | // PrintUpTime(outdev, secs) - print uptime in HH:MM:SS format 108 | // outdev - the device to send output 109 | // secs - the total number of seconds uptime 110 | void PrintUpTime(Print &outdev, unsigned long secs) 111 | { 112 | unsigned int hr, mins, sec; 113 | 114 | // convert total seconds to hours, mins, seconds 115 | mins = secs / 60; // how many total minutes 116 | hr = mins / 60; // how many total hours 117 | mins = mins % 60; // how many minutes within the hour 118 | sec = secs % 60; // how many seconds within the minute 119 | 120 | 121 | // print uptime in HH:MM:SS format 122 | // Print class does not support fixed width formatting 123 | // so insert a zero if number smaller than 10 124 | if(hr < 10) 125 | outdev.write('0'); 126 | outdev.print((int)hr); 127 | outdev.write(':'); 128 | if(mins < 10) 129 | outdev.write('0'); 130 | outdev.print((int)mins); 131 | outdev.write(':'); 132 | if(sec < 10) 133 | outdev.write('0'); 134 | outdev.print((int)sec); 135 | } 136 | 137 | // fatalError() - loop & blink and error code 138 | void fatalError(int ecode) 139 | { 140 | hd44780::fatalError(ecode); // does not return 141 | } 142 | 143 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/Serial2LCD/Serial2LCD.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // Serial2LCD - simple demonstration printing characters from serial port 4 | // Created by Bill Perry 2020-06-28 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCDs with PCF8574 or MCP23008 chip based backpacks 11 | // 12 | // Sketch demonstrates hd44780 how to read a message of characters from 13 | // serial port and display it on the LCD. 14 | // It takes advantage of the hd44780 library automatic line 15 | // wrapping capability. 16 | // See the LineWrap sketch for details about line wrapping. 17 | // 18 | // WARNING: 19 | // Use caution when using 3v only processors like arm and ESP8266 processors 20 | // when interfacing with 5v modules as not doing proper level shifting or 21 | // incorrectly hooking things up can damage the processor. 22 | // 23 | // Configure LCD_COLS, LCD_ROWS and BAUDRATE if desired/needed 24 | // Expected behavior of the sketch: 25 | // - characters received from serial port are displayed on LCD 26 | // - CR and LF are ignored/dropped 27 | // 28 | // If initialization of the LCD fails and the arduino supports a built in LED, 29 | // the sketch will simply blink the built in LED with the initalization error 30 | // code. 31 | // 32 | // NOTE: 33 | // If the sketch fails to produce the expected results, or blinks the LED, 34 | // run the included I2CexpDiag sketch to test the i2c signals and the LCD. 35 | // 36 | // Some 16x1 displays are actually a 8x2 display that have both lines on 37 | // a single line on the display. 38 | // If you have one of these displays, simply set the geometry to 8x2 instead 39 | // of 16x1. 40 | 41 | // include the needed headers. 42 | #include 43 | #include // main hd44780 header 44 | #include // i2c expander i/o class header 45 | 46 | hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip 47 | 48 | // LCD geometry 49 | // while 16x2 will work on most displays even if the geometry is different, 50 | // for actual wrap testing of a particular LCD it is best to use the correct 51 | // geometry. 52 | const int LCD_COLS = 16; 53 | const int LCD_ROWS = 2; 54 | 55 | const int BAUDRATE = 9600; 56 | 57 | void setup() 58 | { 59 | int status; 60 | 61 | // initalize Serial port 62 | Serial.begin(BAUDRATE); 63 | 64 | // initialize LCD with number of columns and rows: 65 | // hd44780 returns a status from begin() that can be used 66 | // to determine if initalization failed. 67 | // the actual status codes are defined in 68 | status = lcd.begin(LCD_COLS, LCD_ROWS); 69 | if(status) // non zero status means it was unsuccesful 70 | { 71 | // begin() failed 72 | 73 | Serial.print("LCD initalization failed: "); 74 | Serial.println(status); 75 | 76 | // blink error code using the onboard LED if possible 77 | hd44780::fatalError(status); // does not return 78 | } 79 | 80 | // turn on automatic line wrapping 81 | // which automatically wraps lines to the next lower line and wraps back 82 | // to the top when at the bottom line 83 | // NOTE: 84 | // noLineWrap() can be used to disable automatic line wrapping. 85 | // _write() can be called instead of write() to send data bytes 86 | // to the display bypassing any special character or line wrap processing. 87 | lcd.lineWrap(); 88 | 89 | lcd.print("Serial2LCD"); 90 | if(LCD_ROWS > 1) 91 | { 92 | lcd.setCursor(0,1); 93 | lcd.print("Baud:"); 94 | lcd.print(BAUDRATE); 95 | } 96 | } 97 | 98 | void loop() 99 | { 100 | 101 | // check to see if characters available 102 | // indicating a message is coming in 103 | if (Serial.available()) 104 | { 105 | // wait some time for rest of message to arrive 106 | delay(100); 107 | 108 | // Clear the display before showing the new message 109 | lcd.clear(); 110 | 111 | // print the message on the LCD 112 | while (Serial.available() > 0) 113 | { 114 | char c; 115 | c = Serial.read(); 116 | if(c != '\r' && c != '\n') // drop CR and LF characters 117 | lcd.write(c); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/SoftwareWire/SoftwareWire.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // SoftwareWire - how to use SoftwareWire library with hd44780_I2Cexp 4 | // Created by Bill Perry 2020-01-01 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // Demonstrates how to use the SoftwareWire library to allow using different 11 | // Arduino pins for SDA and SCL signals. 12 | // 13 | // Sketch prints "Hello, World!" on the lcd 14 | // 15 | // If initialization of the LCD fails and the arduino supports a built in LED, 16 | // the sketch will simply blink the built in LED. 17 | // 18 | // WARNING: 19 | // The SoftWareWire developers made a major change to the library June 2018 20 | // which is in the subsequent 1.5.1 release that causes it be unusable by 21 | // the hd44780 library. 22 | // Until this change is backed out, you will not be able to use 23 | // SoftWareWire beyond version 1.5.0 with the hd44780 library. 24 | // This sketh will do a check to try to detect the incompatibilty issue 25 | // and will error off with a compiler error when detected. 26 | // See this github issue for details: 27 | // https://github.com/Testato/SoftwareWire/issues/28 28 | // 29 | // NOTE: 30 | // Using the SoftwareWire library is not necessary on the espXXXX platform as 31 | // that platform already has the ability to configure the pins used in the 32 | // Wire library. 33 | // On the esp platforms, include and set the pins by passing them to 34 | // Wire.begin(sda, scl) *before* calling lcd.begin() 35 | // 36 | // 37 | // ---------------------------------------------------------------------------- 38 | 39 | // define the Arduino pins you want to use for sda and scl signals 40 | // use any Arduino pins you want, 41 | // this uses same pins as the i2c h/w pins (SDA, SCL) 42 | const int sda=SDA, scl=SCL; 43 | 44 | #include // make sure to not use beyond version 1.5.0 45 | // Check for "new" SoftwareWire that breaks things 46 | #if defined(TwoWire_h) 47 | #error incompatible version of SoftwareWire library (use version 1.5.0) 48 | #endif 49 | 50 | SoftwareWire Wire(sda,scl); // Create Wire object using desired Arduino pins 51 | 52 | #include 53 | #include 54 | hd44780_I2Cexp lcd; // declare lcd object and let it auto-configure everything. 55 | 56 | void setup() 57 | { 58 | int istatus; 59 | 60 | istatus = lcd.begin(16,2); 61 | if(istatus) 62 | { 63 | // LCD initalization failed. 64 | // handle it anyway you want 65 | lcd.fatalError(istatus); // blinks error code on built in LED 66 | } 67 | lcd.print("Hello, World!"); 68 | lcd.setCursor(0,1); 69 | lcd.print("SoftwareWire"); 70 | } 71 | 72 | void loop() { } 73 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/UpTime/UpTime.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // UpTime - simple demonstration of lcd 4 | // Created by Bill Perry 2017-05-11 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCDs with PCF8574 or MCP23008 chip based backpacks 11 | // 12 | // WARNING: 13 | // Use caution when using 3v only processors like arm and ESP8266 processors 14 | // when interfacing with 5v modules as not doing proper level shifting or 15 | // incorrectly hooking things up can damage the processor. 16 | // 17 | // Sketch will print "UpTime" on top row of lcd 18 | // and will print the amount of time since the Arduino has been reset 19 | // on the second row. 20 | // 21 | // If initialization of the LCD fails and the arduino supports a built in LED, 22 | // the sketch will simply blink the built in LED. 23 | // 24 | // NOTE: 25 | // If the sketch fails to produce the expected results, or blinks the LED, 26 | // run the included I2CexpDiag sketch to test the i2c signals and the LCD. 27 | 28 | #include 29 | #include // main hd44780 header 30 | #include // i2c expander i/o class header 31 | 32 | hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip 33 | 34 | // LCD geometry 35 | const int LCD_COLS = 16; 36 | const int LCD_ROWS = 2; 37 | 38 | void setup() 39 | { 40 | int status; 41 | 42 | // initialize LCD with number of columns and rows: 43 | // hd44780 returns a status from begin() that can be used 44 | // to determine if initalization failed. 45 | // the actual status codes are defined in 46 | // See the values RV_XXXX 47 | // 48 | // looking at the return status from begin() is optional 49 | // it is being done here to provide feedback should there be an issue 50 | // 51 | // note: 52 | // begin() will automatically turn on the backlight 53 | // 54 | 55 | status = lcd.begin(LCD_COLS, LCD_ROWS); 56 | if(status) // non zero status means it was unsuccesful 57 | { 58 | // hd44780 has a fatalError() routine that blinks an led if possible 59 | // begin() failed so call fatalError() with the error code. 60 | hd44780::fatalError(status); // does not return 61 | } 62 | // initalization was successful, the backlight should be on now 63 | 64 | // Print a message to the LCD 65 | lcd.print(" UpTime"); 66 | 67 | if(LCD_ROWS < 2) 68 | delay(3000); 69 | } 70 | 71 | void loop() 72 | { 73 | static unsigned long lastsecs = -1; // pre-initialize with non zero value 74 | unsigned long secs; 75 | int status; 76 | 77 | secs = millis() / 1000; 78 | 79 | // see if 1 second has passed 80 | // so the display is only updated once per second 81 | if(secs != lastsecs) 82 | { 83 | lastsecs = secs; // keep track of last seconds 84 | 85 | // set the cursor position to column 0, row 1 86 | // note: row 1 is the second row from top, 87 | // since row counting begins with 0 88 | // if display has only 1 line, it will appear on that line 89 | status = lcd.setCursor(0, 1); 90 | if(status) // non zero status means it was unsuccesful 91 | { 92 | // setCursor() failed so call fatalError() with the error code. 93 | hd44780::fatalError(status); // does not return 94 | } 95 | 96 | // print uptime on lcd device: (time since last reset) 97 | PrintUpTime(lcd, secs); 98 | } 99 | } 100 | 101 | // PrintUpTime(outdev, secs) - print uptime in HH:MM:SS format 102 | // outdev - the device to send output 103 | // secs - the total number of seconds uptime 104 | // 105 | // This is a fancy output routine. 106 | // outdev is a Print class object which indicates 107 | // where the output should be sent. 108 | // PrintUpTime can be used with any object that uses the Print class. 109 | // This code works with Serial objects, as well as the the hd44780 lcd objects. 110 | // i.e. you can call with Serial: PrintUpTime(Serial, seconds); 111 | 112 | void PrintUpTime(Print &outdev, unsigned long secs) 113 | { 114 | unsigned int hr, mins, sec; 115 | 116 | // convert total seconds to hours, mins, seconds 117 | mins = secs / 60; // how many total minutes 118 | hr = mins / 60; // how many total hours 119 | mins = mins % 60; // how many minutes within the hour 120 | sec = secs % 60; // how many seconds within the minute 121 | 122 | // print uptime in HH:MM:SS format 123 | 124 | if(hr > 99) 125 | hr %= 100; // limit hr to 0-99 126 | 127 | // Print class does not support fixed width formatting 128 | // so insert a zero if number smaller than 10 129 | 130 | if(hr < 10) 131 | outdev.write('0'); 132 | outdev.print((int)hr); 133 | outdev.write(':'); 134 | if(mins < 10) 135 | outdev.write('0'); 136 | outdev.print((int)mins); 137 | outdev.write(':'); 138 | if(sec < 10) 139 | outdev.write('0'); 140 | outdev.print((int)sec); 141 | } 142 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDcharset - Display LCD character set 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDcharset. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDcharset/LCDcharset.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDcharset 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // define the LCD geometry 23 | #define LCD_COLS 16 24 | #define LCD_ROWS 2 25 | 26 | // declare the lcd object 27 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 28 | 29 | // tell the hd44780 sketch the lcd object has been declared 30 | #define HD44780_LCDOBJECT 31 | 32 | // include the hd44780 library LCDcharset sketch source code 33 | #include 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for hd44780 hd44780_I2Cexp i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object 23 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 24 | 25 | // tell the hd44780 sketch the lcd object has been declared 26 | #define HD44780_LCDOBJECT 27 | 28 | // include the hd44780 library LCDiSpeed sketch source code 29 | #include 30 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for hd44780 hd44780_I2Cexp i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object 30 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 31 | 32 | // tell the hd44780 sketch the lcd object has been declared 33 | #define HD44780_LCDOBJECT 34 | 35 | // include the hd44780 library LCDiSpeed sketch source code 36 | #include 37 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/hd44780examples/LCDlibTest/LCDlibTest.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch for hd44780 hd44780_I2Cexp i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object 23 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 24 | 25 | // tell the hd44780 sketch the lcd object has been declared 26 | #define HD44780_LCDOBJECT 27 | 28 | // include the hd44780 library sketch source code 29 | #include 30 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/hd44780examples/LCDlibTest400/LCDlibTest400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch for hd44780 hd44780_I2Cexp i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object 30 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 31 | 32 | // tell the hd44780 sketch the lcd object has been declared 33 | #define HD44780_LCDOBJECT 34 | 35 | // include the hd44780 library sketch source code 36 | #include 37 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/hd44780examples/lcdproc/lcdproc.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch for hd44780_I2Cexp i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object 23 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 24 | 25 | // tell the hd44780 sketch the lcd object has been declared 26 | #define HD44780_LCDOBJECT 27 | 28 | // include the hd44780 library sketch source code 29 | #include 30 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Cexp/hd44780examples/lcdproc400/lcdproc400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch for hd44780_I2Cexp i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object 30 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 31 | 32 | // tell the hd44780 sketch the lcd object has been declared 33 | #define HD44780_LCDOBJECT 34 | 35 | // include the hd44780 library sketch source code 36 | #include 37 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // HelloWorld - simple demonstration of lcd 4 | // Created by Bill Perry 2016-07-02 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCD modules that have a native I2C interface such as 11 | // PCF2119x, PCF2116, or certain RayStar LCDs rather than those LCD modules that 12 | // use an i/o expander chip based based backpack. 13 | // NOTE: 14 | // These devices usually need external pullups as they typically are not on 15 | // the module. 16 | // WARNING: 17 | // Use caution when using 3v only processors like arm and ESP8266 processors 18 | // when interfacing with 5v modules as not doing proper level shifting or 19 | // incorrectly hooking things up can damage the processor. 20 | // 21 | // Sketch prints "Hello, World!" on the lcd 22 | // 23 | // If initialization of the LCD fails and the arduino supports a built in LED, 24 | // the sketch will simply blink the built in LED. 25 | // 26 | // ---------------------------------------------------------------------------- 27 | // LiquidCrystal compability: 28 | // Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal 29 | // sketches should work with hd44780 hd44780_I2Clcd i/o class once the 30 | // includes are changed to use hd44780 and the lcd object constructor is 31 | // changed to use the hd44780_I2Clcd i/o class. 32 | 33 | #include 34 | #include 35 | #include // i2c LCD i/o class header 36 | 37 | // Note, i2c address can be specified or automatically located 38 | // If you wish to use a specific address comment out this constructor 39 | // and use the constructor below that specifies the address 40 | 41 | // declare the lcd object for auto i2c address location 42 | hd44780_I2Clcd lcd; 43 | 44 | // 45 | // enter address of LCD. 46 | // Addresses seen so far include: 47 | // - 0x3a, 0x3b (PCF2119x) 48 | // - 0x3c (unknwon chip) 49 | // - 0x3d (unknwon chip) 50 | // - 0x3e (unknwon chip) 51 | // - 0x3f (unknwon chip) 52 | 53 | // declare i2c address and constructor for specified i2c address 54 | //const int i2c_addr = 0x3e; 55 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 56 | 57 | 58 | // LCD geometry 59 | const int LCD_COLS = 16; 60 | const int LCD_ROWS = 2; 61 | void setup() 62 | { 63 | int status; 64 | 65 | // initialize LCD with number of columns and rows: 66 | // hd44780 returns a status from begin() that can be used 67 | // to determine if initalization failed. 68 | // the actual status codes are defined in 69 | // See the values RV_XXXX 70 | // 71 | // looking at the return status from begin() is optional 72 | // it is being done here to provide feedback should there be an issue 73 | // 74 | status = lcd.begin(LCD_COLS, LCD_ROWS); 75 | if(status) // non zero status means it was unsuccesful 76 | { 77 | // begin() failed so blink error code using the onboard LED if possible 78 | hd44780::fatalError(status); // does not return 79 | } 80 | 81 | // Print a message to the LCD 82 | lcd.print("Hello, World!"); 83 | } 84 | 85 | void loop() {} 86 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/README.md: -------------------------------------------------------------------------------- 1 | hd44780_I2Clcd examples 2 | ======================= 3 | 4 | The examples included in this directory are for the hd44780_I2Clcd i/o class.
5 | The hd44780_I2Clcd i/o class controls an LCD with a native i2c interface that uses chips like the PCF2116, PCF2119x etc... 6 | 7 | #### The following examples are included: 8 | 9 | - `HelloWorld`
10 | Prints "Hello, World!" on the lcd 11 | 12 | - `LCDCustomChars`
13 | Demonstrates using custom characters 14 | 15 | - `LineWrap`
16 | Demonstrates automatic linewrap functionality 17 | 18 | - `Serial2LCD`
19 | Displays a message read from the serial port on the lcd. 20 | 21 | - `UpTime`
22 | Prints the amount of time since the Arduino has been reset. 23 | 24 | - `hd44780examples`
25 | The hd44780examples subdirectory contains 26 | hd44780_I2Clcd class specific wrapper sketches for sketches under 27 | examples/hd44780examples. 28 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/Serial2LCD/Serial2LCD.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // Serial2LCD - simple demonstration printing characters from serial port 4 | // Created by Bill Perry 2020-06-28 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCD modules that have a native I2C interface such as 11 | // PCF2119x, PCF2116, or certain RayStar LCDs rather than those LCD modules that 12 | // use an i/o expander chip based based backpack. 13 | // 14 | // Sketch demonstrates hd44780 how to read a message of characters from 15 | // serial port and display it on the LCD. 16 | // It takes advantage of the hd44780 library automatic line 17 | // wrapping capability. 18 | // See the LineWrap sketch for details about line wrapping. 19 | // 20 | // NOTE: 21 | // These devices usually need external pullups as they typically are not on 22 | // the module. 23 | // WARNING: 24 | // Use caution when using 3v only processors like arm and ESP8266 processors 25 | // when interfacing with 5v modules as not doing proper level shifting or 26 | // incorrectly hooking things up can damage the processor. 27 | // 28 | // Configure LCD_COLS, LCD_ROWS and BAUDRATE if desired/needed 29 | // Expected behavior of the sketch: 30 | // - characters received from serial port are displayed on LCD 31 | // - CR and LF are ignored/dropped 32 | // 33 | // If initialization of the LCD fails and the arduino supports a built in LED, 34 | // the sketch will simply blink the built in LED with the initalization error 35 | // code. 36 | // 37 | // Some 16x1 displays are actually a 8x2 display that have both lines on 38 | // a single line on the display. 39 | // If you have one of these displays, simply set the geometry to 8x2 instead 40 | // of 16x1. 41 | 42 | // include the needed headers. 43 | #include 44 | #include // main hd44780 header 45 | #include // i2c LCD i/o class header 46 | 47 | // Note, i2c address can be specified or automatically located 48 | // If you wish to use a specific address comment out this constructor 49 | // and use the constructor below that specifies the address 50 | 51 | // declare the lcd object for auto i2c address location 52 | hd44780_I2Clcd lcd; 53 | 54 | // 55 | // enter address of LCD. 56 | // Addresses seen so far include: 57 | // - 0x3a, 0x3b (PCF2119x) 58 | // - 0x3c (unknwon chip) 59 | // - 0x3d (unknwon chip) 60 | // - 0x3e (unknwon chip) 61 | // - 0x3f (unknwon chip) 62 | 63 | // declare i2c address and constructor for specified i2c address 64 | //const int i2c_addr = 0x3e; 65 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 66 | 67 | // LCD geometry 68 | // while 16x2 will work on most displays even if the geometry is different, 69 | // for actual wrap testing of a particular LCD it is best to use the correct 70 | // geometry. 71 | const int LCD_COLS = 16; 72 | const int LCD_ROWS = 2; 73 | 74 | const int BAUDRATE = 9600; 75 | 76 | void setup() 77 | { 78 | int status; 79 | 80 | // initalize Serial port 81 | Serial.begin(BAUDRATE); 82 | 83 | // initialize LCD with number of columns and rows: 84 | // hd44780 returns a status from begin() that can be used 85 | // to determine if initalization failed. 86 | // the actual status codes are defined in 87 | status = lcd.begin(LCD_COLS, LCD_ROWS); 88 | if(status) // non zero status means it was unsuccesful 89 | { 90 | // begin() failed 91 | 92 | Serial.print("LCD initalization failed: "); 93 | Serial.println(status); 94 | 95 | // blink error code using the onboard LED if possible 96 | hd44780::fatalError(status); // does not return 97 | } 98 | 99 | // turn on automatic line wrapping 100 | // which automatically wraps lines to the next lower line and wraps back 101 | // to the top when at the bottom line 102 | // NOTE: 103 | // noLineWrap() can be used to disable automatic line wrapping. 104 | // _write() can be called instead of write() to send data bytes 105 | // to the display bypassing any special character or line wrap processing. 106 | lcd.lineWrap(); 107 | 108 | lcd.print("Serial2LCD"); 109 | if(LCD_ROWS > 1) 110 | { 111 | lcd.setCursor(0,1); 112 | lcd.print("Baud:"); 113 | lcd.print(BAUDRATE); 114 | } 115 | } 116 | 117 | void loop() 118 | { 119 | 120 | // check to see if characters available 121 | // indicating a message is coming in 122 | if (Serial.available()) 123 | { 124 | // wait some time for rest of message to arrive 125 | delay(100); 126 | 127 | // Clear the display before showing the new message 128 | lcd.clear(); 129 | 130 | // print the message on the LCD 131 | while (Serial.available() > 0) 132 | { 133 | char c; 134 | c = Serial.read(); 135 | if(c != '\r' && c != '\n') // drop CR and LF characters 136 | lcd.write(c); 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDcharset - Display LCD character set 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDcharset. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDcharset/LCDcharset.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDcharset 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // define the LCD geometry 23 | #define LCD_COLS 16 24 | #define LCD_ROWS 2 25 | 26 | // declare the lcd object for auto i2c address location 27 | hd44780_I2Clcd lcd; 28 | 29 | // declare i2c address and constructor for specified i2c address 30 | //const int i2c_addr = 0x3e; 31 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 32 | 33 | // tell the hd44780 sketch the lcd object has been declared 34 | #define HD44780_LCDOBJECT 35 | 36 | // include the hd44780 library LCDcharset sketch source code 37 | #include 38 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object for auto i2c address location 23 | hd44780_I2Clcd lcd; 24 | 25 | // declare i2c address and constructor for specified i2c address 26 | //const int i2c_addr = 0x3e; 27 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 28 | 29 | // tell the hd44780 sketch the lcd object has been declared 30 | #define HD44780_LCDOBJECT 31 | 32 | // include the hd44780 library LCDiSpeed sketch source code 33 | #include 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object for auto i2c address location 30 | hd44780_I2Clcd lcd; 31 | 32 | // declare i2c address and constructor for specified i2c address 33 | //const int i2c_addr = 0x3e; 34 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library LCDiSpeed sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/hd44780examples/LCDlibTest/LCDlibTest.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object for auto i2c address location 23 | hd44780_I2Clcd lcd; 24 | 25 | // declare i2c address and constructor for specified i2c address 26 | //const int i2c_addr = 0x3e; 27 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 28 | 29 | // tell the hd44780 sketch the lcd object has been declared 30 | #define HD44780_LCDOBJECT 31 | 32 | // include the hd44780 library sketch source code 33 | #include 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/hd44780examples/LCDlibTest400/LCDlibTest400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object for auto i2c address location 30 | hd44780_I2Clcd lcd; 31 | 32 | // declare i2c address and constructor for specified i2c address 33 | //const int i2c_addr = 0x3e; 34 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/hd44780examples/lcdproc/lcdproc.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | // declare the lcd object for auto i2c address location 23 | hd44780_I2Clcd lcd; 24 | 25 | // declare i2c address and constructor for specified i2c address 26 | //const int i2c_addr = 0x3e; 27 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 28 | 29 | // tell the hd44780 sketch the lcd object has been declared 30 | #define HD44780_LCDOBJECT 31 | 32 | // include the hd44780 library sketch source code 33 | #include 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_I2Clcd/hd44780examples/lcdproc400/lcdproc400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include 20 | #include // include i/o class header 21 | 22 | #if ARDUINO < 157 23 | #error "This sketch Requires Arduino 1.5.7 or higher" 24 | #endif 25 | 26 | // NOTE: uses API that only works on IDE 1.5.7 and up 27 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 28 | 29 | // declare the lcd object for auto i2c address location 30 | hd44780_I2Clcd lcd; 31 | 32 | // declare i2c address and constructor for specified i2c address 33 | //const int i2c_addr = 0x3e; 34 | //hd44780_I2Clcd lcd(i2c_addr); // use device at this address 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU165ECPB/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // HelloWorld - simple demonstration of lcd 4 | // Created by Bill Perry 2016-07-02 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for the Nortake CU165ECBP-T2J display 11 | // 12 | // Sketch prints "Hello, World!" on the LCD 13 | // 14 | // If initialization of the LCD fails and the arduino supports a built in LED, 15 | // the sketch will simply blink the built in LED. 16 | // 17 | // Datasheet can be found here: 18 | // http://www.blog.zapro.dk/wp-content/CU165.pdf 19 | // Full datasheet/release notes: 20 | // http://www.blog.zapro.dk/wp-content/CU165ECPB_T2J_specification.pdf 21 | // 22 | // The device uses SPI for communication. 23 | // Pinout: 24 | // 1 Vcc 25 | // 2 GND 26 | // 3 /CS (SS) - Digital Pin 10 on Uno 27 | // 4 CLK (SCK) - Digital Pin 13 on Uno 28 | // 5 DATA (MOSI) - Digital Pin 11 on Uno 29 | // 30 | // ---------------------------------------------------------------------------- 31 | // LiquidCrystal compability: 32 | // Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal 33 | // sketches should work with hd44780 hd44780_NTCU165ECPB i/o class once the 34 | // includes are changed to use hd44780 and the lcd object constructor is 35 | // changed to use the hd44780_I2CNTCU165ECPB i/o class/ 36 | 37 | #include // optional, include to use h/w spi 38 | #include 39 | #include // include io class header 40 | 41 | // constructor parameters: 42 | // lcd([cs], [clock, data]) 43 | // If no parameters, then library will use SS, SCK, and MOSI pins 44 | // If cs parameter specified, then use it for chip select then SCK and MOSI 45 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 46 | // h/w spi will be used 47 | // If h/w spi is not possible, then the code will fall back to bit banging. 48 | // 49 | // NOTE: 50 | // - Leonardo h/w is "stupid" and does not bring out SS 51 | // (it only drives an LED) 52 | // - Leonardo does not bring SPI signals to female headers, 53 | // they are only on 6 pin ISP header. 54 | // - ESP8266 is does not use naked constants for digital pin numbers 55 | // 56 | // 57 | // To work around these pin issues in this sketch, 58 | // Leonardo will use uno digital pins for SPI h/w which means it will 59 | // will not use h/w spi. All the other boards will use the h/w SPI pins. 60 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 61 | // 62 | 63 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 64 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 65 | #else 66 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 67 | #endif 68 | hd44780_NTCU165ECPB lcd(cs, clk, data); // declare lcd object 69 | 70 | // LCD geometry 71 | const int LCD_ROWS = 1; 72 | const int LCD_COLS = 16; 73 | 74 | void setup() 75 | { 76 | // Special Note: 77 | // ============= 78 | // Since this device uses a write only SPI interface, there is no way for 79 | // the library/sketch to know if the device is present or if there is any 80 | // type of issue communicating with the device. 81 | // So while begin() returns a status as to whether it was successful, 82 | // the library will never report a failure since it has no way of detecting 83 | // a communication or initialization issue. 84 | 85 | // initialize LCD with number of columns and rows: 86 | lcd.begin(LCD_COLS, LCD_ROWS); 87 | 88 | // Print a message to the LCD 89 | lcd.print("Hello, World!"); 90 | } 91 | 92 | void loop(){} 93 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU165ECPB/README.md: -------------------------------------------------------------------------------- 1 | hd44780_NTCU165ECPB examples 2 | ======================= 3 | 4 | The examples included in this directory are for the hd44780_NTCU165ECPB i/o class.
5 | The hd44780_NTCU165ECPB i/o class is used to control a Noritake CU165ECBP-T2J LCD display over SPI 6 | 7 | 8 | #### The following examples are included: 9 | 10 | - `HelloWorld`
11 | Prints "Hello, World!" on the lcd 12 | 13 | - `LCDCustomChars`
14 | Demonstrates using custom characters 15 | 16 | - `LineWrap`
17 | Demonstrates automatic linewrap functionality 18 | 19 | - `Serial2LCD`
20 | Displays a message read from the serial port on the lcd. 21 | 22 | - `UpTime`
23 | Prints the amount of time since the Arduino has been reset. 24 | 25 | - `hd44780examples`
26 | The hd44780examples subdirectory contains 27 | hd44780_NTCU165ECPB class specific wrapper sketches for sketches under 28 | examples/hd44780examples. 29 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU165ECPB/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDcharset - Display LCD character set for hd44780 hd44780_NTCU165ECPB i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDcharset. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDcharset/LCDcharset.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDcharset 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | // define the LCD geometry 23 | #define LCD_COLS 16 24 | #define LCD_ROWS 1 25 | 26 | // constructor parameters: 27 | // lcd([cs], [clock, data]) 28 | // If no parameters, then library will use SS, SCK, and MOSI pins 29 | // If cs parameter specified, then use it for chip select then SCK and MOSI 30 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 31 | // h/w spi will be used 32 | // If h/w spi is not possible, then the code will fall back to bit banging. 33 | // 34 | // NOTE: 35 | // - Leonardo h/w is "stupid" and does not bring out SS 36 | // (it only drives an LED) 37 | // - Leonardo does not bring SPI signals to female headers, 38 | // they are only on 6 pin ISP header. 39 | // - ESP8266 is does not use naked constants for digital pin numbers 40 | // 41 | // 42 | // To work around these pin issues in this sketch, 43 | // Leonardo will use uno digital pins for SPI h/w which means it will 44 | // will not use h/w spi. All the other boards will use the h/w SPI pins. 45 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 46 | // 47 | 48 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 49 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 50 | #else 51 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 52 | #endif 53 | hd44780_NTCU165ECPB lcd(cs, clk, data); // declare lcd object 54 | 55 | // tell the hd44780 sketch the lcd object has been declared 56 | #define HD44780_LCDOBJECT 57 | 58 | // include the hd44780 library LCDcharset sketch source code 59 | #include 60 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU165ECPB/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for hd44780_NTCU165ECPB i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o sub library. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #define LCD_ROWS 1 23 | #define LCD_COLS 16 24 | 25 | // constructor parameters: 26 | // lcd([cs], [clock, data]) 27 | // If no parameters, then library will use SS, SCK, and MOSI pins 28 | // If cs parameter specified, then use it for chip select then SCK and MOSI 29 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 30 | // h/w spi will be used 31 | // If h/w spi is not possible, then the code will fall back to bit banging. 32 | // 33 | // NOTE: 34 | // - Leonardo h/w is "stupid" and does not bring out SS 35 | // (it only drives an LED) 36 | // - Leonardo does not bring SPI signals to female headers, 37 | // they are only on 6 pin ISP header. 38 | // - ESP8266 is does not use naked constants for digital pin numbers 39 | // 40 | // 41 | // To work around these pin issues in this sketch, 42 | // Leonardo will use uno digital pins for SPI h/w which means it will 43 | // will not use h/w spi. All the other boards will use the h/w SPI pins. 44 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 45 | // 46 | 47 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 48 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 49 | #else 50 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 51 | #endif 52 | hd44780_NTCU165ECPB lcd(cs, clk, data); // declare lcd object 53 | 54 | // tell the hd44780 sketch the lcd object has been declared 55 | #define HD44780_LCDOBJECT 56 | 57 | // include the hd44780 library sketch source code 58 | #include 59 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU165ECPB/hd44780examples/LCDlibTest/LCDlibTest.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch for hd44780_NTCU165ECPB i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o sub library. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #define LCD_ROWS 1 23 | #define LCD_COLS 16 24 | 25 | // constructor parameters: 26 | // lcd([cs], [clock, data]) 27 | // If no parameters, then library will use SS, SCK, and MOSI pins 28 | // If cs parameter specified, then use it for chip select then SCK and MOSI 29 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 30 | // h/w spi will be used 31 | // If h/w spi is not possible, then the code will fall back to bit banging. 32 | // 33 | // NOTE: 34 | // - Leonardo h/w is "stupid" and does not bring out SS 35 | // (it only drives an LED) 36 | // - Leonardo does not bring SPI signals to female headers, 37 | // they are only on 6 pin ISP header. 38 | // - ESP8266 is does not use naked constants for digital pin numbers 39 | // 40 | // 41 | // To work around these pin issues in this sketch, 42 | // Leonardo will use uno digital pins for SPI h/w which means it will 43 | // will not use h/w spi. All the other boards will use the h/w SPI pins. 44 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 45 | // 46 | 47 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 48 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 49 | #else 50 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 51 | #endif 52 | hd44780_NTCU165ECPB lcd(cs, clk, data); // declare lcd object 53 | 54 | // tell the hd44780 sketch the lcd object has been declared 55 | #define HD44780_LCDOBJECT 56 | 57 | // include the hd44780 library sketch source code 58 | #include 59 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU20025ECPB_pinIO/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // HelloWorld - simple demonstration of lcd 4 | // Created by Bill Perry 2019-11-23 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for Noritake CU-U series displays like the 11 | // Noritake CU20025ECPB-U1J or CU20025ECPB-W1J 12 | // The Noritake CU20025ECPB display is a 20x2 line VFD display. 13 | // It is not a hd44780 display but is nearly fully compatible with a hd44780 14 | // display. The only real difference is the backlight control. 15 | // So while this device is supported by the hd44780 library, 16 | // the subclass will do its best to emulatate hd44780 functions and map 17 | // them to equivalent functionality when possible. 18 | // 19 | // Sketch prints "Hello, World!" on the lcd 20 | // 21 | // See below for configuring the Arduino pins used. 22 | // 23 | // Noritake CU-U series LCD module pins 24 | // 1 - LCD gnd 25 | // 2 - VCC (5v) 26 | // 3 - not connected 27 | // 4 - RS Register Select (rs) --- connect to Arduino pin 28 | // 5 - Read/Write ------ connect to gnd 29 | // 6 - Enable (en) ----- connect to Arduino pin 30 | // 7 - Data 0 (db0) ---- 31 | // 8 - Data 1 (db1) |-------- Not used in 4 bit mode 32 | // 9 - Data 2 (db2) | 33 | // 10 - Data 3 (db3) ---- 34 | // 11 - Data 4 (db4) ---- connect to Arduino pin 35 | // 12 - Data 5 (db5) ---- connect to Arduino pin 36 | // 13 - Data 6 (db6) ---- connect to Arduino pin 37 | // 14 - Data 7 (db7) ---- connect to Arduino pin 38 | // 39 | // ---------------------------------------------------------------------------- 40 | // LiquidCrystal compability: 41 | // Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal 42 | // sketches should work with hd44780 hd44780_NTCU20025ECPB_pinIO i/o class 43 | // once the includes are changed to use hd44780 and the lcd object constructor 44 | // is changed to use the hd44780_NTCU20025ECPB_pinIO class. 45 | 46 | #include 47 | #include // Arduino pin i/o class header 48 | 49 | // declare Arduino pins used for LCD functions 50 | // and the lcd object 51 | // The parameters used by hd44780_NTCU20025ECPB_pinIO are the same as those 52 | // used by the IDE bundled LiquidCrystal library 53 | // note that ESP8266 based arduinos must use the Dn defines rather than 54 | // raw pin numbers. 55 | #if defined (ARDUINO_ARCH_ESP8266) 56 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // for esp8266 devices 57 | #else 58 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // for all other devices 59 | #endif 60 | hd44780_NTCU20025ECPB_pinIO lcd(rs, en, db4, db5, db6, db7); 61 | 62 | // LCD geometry 63 | const int LCD_COLS = 20; 64 | const int LCD_ROWS = 2; 65 | 66 | void setup() 67 | { 68 | // initialize LCD with number of columns and rows: 69 | // 70 | // note: 71 | // begin() will automatically turn on the backlight if backlight 72 | // control is specified in the lcd object constructor 73 | // 74 | lcd.begin(LCD_COLS, LCD_ROWS); 75 | 76 | // if backlight control was specified, the backlight should be on now 77 | 78 | // Print a message to the LCD 79 | lcd.print("Hello, World!"); 80 | } 81 | 82 | void loop() {} 83 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU20025ECPB_pinIO/README.md: -------------------------------------------------------------------------------- 1 | hd44780_NTCU20025ECPB_pinIOexamples 2 | =================================== 3 | 4 | The examples included in this directory are for the hd44780_NTCU20025ECPB_pinIO i/o class.
5 | The hd44780_NTCU20025ECPB_pinIO i/o class is used to control Noritake 6 | CU-U series displays like the Noritake CU20025ECPB-U1J or CU20025ECPB-W1J 7 | The Noritake CU20025ECPB display is a 20x2 line VFD display. 8 | It is not a hd44780 display but is nearly fully compatible with a hd44780 9 | display. The only real difference is the backlight control. 10 | So while this device is supported by the hd44780 library, 11 | the subclass will do its best to emulatate hd44780 functions and map 12 | them to equivalent functionality when possible. 13 | 14 | #### The following examples are included: 15 | 16 | - `HelloWorld`
17 | Prints "Hello, World!" on the lcd 18 | 19 | - `LCDKeypadCheck`
20 | Tests lcd keypad shields for bad backlight circuitry 21 | 22 | - `LCDCustomChars`
23 | Demonstrates using custom characters 24 | 25 | - `LineWrap`
26 | Demonstrates automatic linewrap functionality 27 | 28 | - `ReadWrite`
29 | Demonstrate the ability to read data from the LCD. 30 | 31 | - `Serial2LCD`
32 | Displays a message read from the serial port on the lcd. 33 | 34 | - `UpTime`
35 | Prints the amount of time since the Arduino has been reset. 36 | 37 | - `hd44780examples`
38 | The hd44780examples subdirectory contains 39 | hd44780_NTCU20025ECPB_pinIOclass specific wrapper sketches for sketches under 40 | examples/hd44780examples. 41 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU20025ECPB_pinIO/Serial2LCD/Serial2LCD.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // Serial2LCD - simple demonstration printing characters from serial port 4 | // Created by Bill Perry 2020-06-28 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for Noritake CU-U series displays like the 11 | // Noritake CU20025ECPB-U1J or CU20025ECPB-W1J 12 | // The Noritake CU20025ECPB display is a 20x2 line VFD display. 13 | // It is not a hd44780 display but is nearly fully compatible with a hd44780 14 | // display. The only real difference is the backlight control. 15 | // So while this device is supported by the hd44780 library, 16 | // the subclass will do its best to emulatate hd44780 functions and map 17 | // them to equivalent functionality when possible. 18 | // 19 | // Sketch demonstrates how to read a message of characters from 20 | // serial port and display it on the LCD. 21 | // It takes advantage of the hd44780 library automatic line 22 | // wrapping capability. 23 | // See the LineWrap sketch for details about line wrapping. 24 | // 25 | // Configure LCD_COLS, LCD_ROWS and BAUDRATE if desired/needed 26 | // Expected behavior of the sketch: 27 | // - characters received from serial port are displayed on LCD 28 | // - CR and LF are ignored/dropped 29 | // 30 | // If initialization of the LCD fails and the arduino supports a built in LED, 31 | // the sketch will simply blink the built in LED with the initalization error 32 | // code. 33 | // 34 | // ---------------------------------------------------------------------------- 35 | // See below for configuring the Arduino pins used. 36 | // 37 | // Noritake CU-U series LCD module pins 38 | // 1 - LCD gnd 39 | // 2 - VCC (5v) 40 | // 3 - not connected 41 | // 4 - RS Register Select (rs) --- connect to Arduino pin 42 | // 5 - Read/Write ------ connect to gnd 43 | // 6 - Enable (en) ----- connect to Arduino pin 44 | // 7 - Data 0 (db0) ---- 45 | // 8 - Data 1 (db1) |-------- Not used in 4 bit mode 46 | // 9 - Data 2 (db2) | 47 | // 10 - Data 3 (db3) ---- 48 | // 11 - Data 4 (db4) ---- connect to Arduino pin 49 | // 12 - Data 5 (db5) ---- connect to Arduino pin 50 | // 13 - Data 6 (db6) ---- connect to Arduino pin 51 | // 14 - Data 7 (db7) ---- connect to Arduino pin 52 | // ---------------------------------------------------------------------------- 53 | 54 | #include 55 | #include // Arduino pin i/o class header 56 | 57 | // declare Arduino pins used for LCD functions 58 | // and the lcd object 59 | 60 | #if defined (ARDUINO_ARCH_ESP8266) 61 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // for esp8266 devices 62 | #else 63 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // for all other devices 64 | #endif 65 | hd44780_NTCU20025ECPB_pinIO lcd(rs, en, db4, db5, db6, db7); 66 | 67 | 68 | // LCD geometry 69 | const int LCD_COLS = 16; 70 | const int LCD_ROWS = 2; 71 | 72 | const int BAUDRATE = 9600; 73 | 74 | void setup() 75 | { 76 | int status; 77 | 78 | // initalize Serial port 79 | Serial.begin(BAUDRATE); 80 | 81 | // initialize LCD with number of columns and rows: 82 | // hd44780 returns a status from begin() that can be used 83 | // to determine if initalization failed. 84 | // the actual status codes are defined in 85 | status = lcd.begin(LCD_COLS, LCD_ROWS); 86 | if(status) // non zero status means it was unsuccesful 87 | { 88 | // begin() failed 89 | 90 | Serial.print("LCD initalization failed: "); 91 | Serial.println(status); 92 | 93 | // blink error code using the onboard LED if possible 94 | hd44780::fatalError(status); // does not return 95 | } 96 | 97 | // turn on automatic line wrapping 98 | // which automatically wraps lines to the next lower line and wraps back 99 | // to the top when at the bottom line 100 | // NOTE: 101 | // noLineWrap() can be used to disable automatic line wrapping. 102 | // _write() can be called instead of write() to send data bytes 103 | // to the display bypassing any special character or line wrap processing. 104 | lcd.lineWrap(); 105 | 106 | lcd.print("Serial2LCD"); 107 | if(LCD_ROWS > 1) 108 | { 109 | lcd.setCursor(0,1); 110 | lcd.print("Baud:"); 111 | lcd.print(BAUDRATE); 112 | } 113 | } 114 | 115 | void loop() 116 | { 117 | 118 | // check to see if characters available 119 | // indicating a message is coming in 120 | if (Serial.available()) 121 | { 122 | // wait some time for rest of message to arrive 123 | delay(100); 124 | 125 | // Clear the display before showing the new message 126 | lcd.clear(); 127 | 128 | // print the message on the LCD 129 | while (Serial.available() > 0) 130 | { 131 | char c; 132 | c = Serial.read(); 133 | if(c != '\r' && c != '\n') // drop CR and LF characters 134 | lcd.write(c); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU20025ECPB_pinIO/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDcharset - Display character set for hd44780_NTCU20025ECPB_pinIO i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDcharset. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDcharset/LCDcharset.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDcharset 16 | // 17 | 18 | #include 19 | #include // include i/o class header 20 | 21 | // declare Arduino pins used for LCD functions 22 | // and the lcd object 23 | 24 | #if defined (ARDUINO_ARCH_ESP8266) 25 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // for esp8266 devices 26 | #else 27 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal pins 28 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 29 | #endif 30 | hd44780_NTCU20025ECPB_pinIO lcd(rs, en, db4, db5, db6, db7); 31 | 32 | #define LCD_COLS 20 33 | #define LCD_ROWS 2 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU20025ECPB_pinIO/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // LCDiSpeed - Speed test for hd44780 hd44780_NTCU20025ECPB_pinIO i/o class 3 | // ------------------------------------------------------------------------ 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include // include i/o class header 20 | 21 | // declare Arduino pins used for LCD functions 22 | // and the lcd object 23 | 24 | #if defined (ARDUINO_ARCH_ESP8266) 25 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // for esp8266 devices 26 | #else 27 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal pins 28 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 29 | #endif 30 | hd44780_NTCU20025ECPB_pinIO lcd(rs, en, db4, db5, db6, db7); 31 | 32 | #define LCD_COLS 20 33 | #define LCD_ROWS 2 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU20025ECPB_pinIO/hd44780examples/LCDlibTest/LCDlibTest.ino: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // LCDLibTest - library test for hd44780 hd44780_NTCU20025ECPB_pinIO i/o class 3 | // --------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include // include i/o class header 20 | 21 | // declare Arduino pins used for LCD functions 22 | // and the lcd object 23 | 24 | #if defined (ARDUINO_ARCH_ESP8266) 25 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // for esp8266 devices 26 | #else 27 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal pins 28 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 29 | #endif 30 | hd44780_NTCU20025ECPB_pinIO lcd(rs, en, db4, db5, db6, db7); 31 | 32 | #define LCD_COLS 20 33 | #define LCD_ROWS 2 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCU20025ECPB_pinIO/hd44780examples/lcdproc/lcdproc.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - lcdproc sketch for hd44780 hd44780_NTCU20025ECPB_pinIO i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include // include i/o class header 20 | 21 | // declare Arduino pins used for LCD functions 22 | // and the lcd object 23 | 24 | #if defined (ARDUINO_ARCH_ESP8266) 25 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // for esp8266 devices 26 | #else 27 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal pins 28 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 29 | #endif 30 | hd44780_NTCU20025ECPB_pinIO lcd(rs, en, db4, db5, db6, db7); 31 | 32 | #define LCD_COLS 20 33 | #define LCD_ROWS 2 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCUUserial/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // HelloWorld - simple demonstration of lcd 4 | // Created by Bill Perry 2016-07-02 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for the Noritake CU-U series VFDs, in native serial mode 11 | // 12 | // Sketch prints "Hello, World!" on the lcd 13 | // 14 | // If initialization of the LCD fails and the arduino supports a built in LED, 15 | // the sketch will simply blink the built in LED. 16 | // 17 | // The application note for CU-U series boards is here: 18 | // https://www.noritake-elec.com/includes/documents/brochure/CU-U_Application_Note.pdf 19 | // Datasheets for specific boards, code samples, and more can be found here: 20 | // https://www.noritake-elec.com/products/vfd-display-module/character-display/cu-u-series 21 | // 22 | // 23 | // The device uses a kind of 3-wire SPI for communication. 24 | // Pinout: 25 | // 1 VCC 26 | // 2 SI/SO (DATA) MOSI - Digital Pin 11 on Uno & Leonardo 27 | // 3 GND 28 | // 4 STB (CS) SS - Digital Pin 10 on Uno & Leonardo 29 | // 5 SCK (CLK) SCK - Digital Pin 13 on Uno & Leonardo 30 | // 6 NC 31 | // 32 | // ---------------------------------------------------------------------------- 33 | // LiquidCrystal compability: 34 | // Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal 35 | // sketches should work with hd44780 hd44780_NTCUUserial i/o class once the 36 | // includes are changed to use hd44780 and the lcd object constructor is 37 | // changed to use the hd44780_NTCUUserial i/o class. 38 | // 39 | 40 | #include // optional, include to use h/w spi 41 | #include // main hd44780 header 42 | #include // Noritake CU-U serial i/o class header 43 | 44 | // constructor parameters: 45 | // lcd([cs], [clock, data]) 46 | // If no parameters, then library will use SS, SCK, and MOSI pins 47 | // If cs parameter specified, then use it for chip select then SCK and MOSI 48 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 49 | // h/w spi will be used 50 | // If h/w spi is not possible, then the code will fall back to bit banging. 51 | // 52 | // NOTE: 53 | // - Leonardo h/w is "stupid" and does not bring out SS 54 | // (it only drives an LED) 55 | // - Leonardo does not bring SPI signals to female headers, 56 | // they are only on 6 pin ISP header. 57 | // - ESP8266 is does not use naked constants for digital pin numbers 58 | // 59 | // 60 | // To work around these pin issues in this sketch, 61 | // Leonardo will use uno digital pins for SPI h/w which means it will 62 | // not use h/w spi. All the other boards will use the h/w SPI pins. 63 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 64 | // 65 | 66 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 67 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 68 | #else 69 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 70 | #endif 71 | hd44780_NTCUUserial lcd(cs, clk, data); // declare lcd object 72 | 73 | // LCD geometry 74 | const int LCD_COLS = 16; 75 | const int LCD_ROWS = 2; 76 | 77 | void setup() 78 | { 79 | int status; 80 | 81 | // initialize LCD with number of columns and rows: 82 | // hd44780 returns a status from begin() that can be used 83 | // to determine if initalization failed. 84 | // the actual status codes are defined in 85 | // See the values RV_XXXX 86 | // 87 | // looking at the return status from begin() is optional 88 | // it is being done here to provide feedback should there be an issue 89 | // 90 | status = lcd.begin(LCD_COLS, LCD_ROWS); 91 | if(status) // non zero status means it was unsuccesful 92 | { 93 | // begin() failed so blink error code using the onboard LED if possible 94 | hd44780::fatalError(status); // does not return 95 | } 96 | 97 | // Print a message to the LCD 98 | lcd.print("Hello, World!"); 99 | } 100 | 101 | void loop() {} 102 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCUUserial/README.md: -------------------------------------------------------------------------------- 1 | hd44780_NTCUUserial examples 2 | ======================= 3 | 4 | The examples included in this directory are for the hd44780_NTCUUserial i/o class.
5 | The hd44780_NTCUUserial i/o class controls the Noritake CU-U series VFD with a native serial interface 6 | 7 | 8 | #### The following examples are included: 9 | 10 | - `HelloWorld`
11 | Prints "Hello, World!" on the vfd 12 | 13 | - `LCDCustomChars`
14 | Demonstrates using custom characters 15 | 16 | - `LineWrap`
17 | Demonstrates automatic linewrap functionality 18 | 19 | - `ReadWrite`
20 | Demonstrates the ability to read data from the VFD. 21 | 22 | - `Serial2LCD`
23 | Displays a message read from the serial port on the lcd. 24 | 25 | - `UpTime`
26 | Prints the amount of time since the Arduino has been reset. 27 | 28 | - `hd44780examples`
29 | The hd44780examples subdirectory contains 30 | hd44780_NTCUUserial class specific wrapper sketches for sketches under 31 | examples/hd44780examples. 32 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCUUserial/Serial2LCD/Serial2LCD.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // Serial2LCD - simple demonstration printing characters from serial port 4 | // Created by Bill Perry 2020-06-28 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for the Noritake CU-U series VFDs, in native serial mode 11 | // 12 | // Sketch demonstrates hd44780 how to read a message of characters from 13 | // serial port and display it on the LCD. 14 | // It takes advantage of the hd44780 library automatic line 15 | // wrapping capability. 16 | // See the LineWrap sketch for details about line wrapping. 17 | // 18 | // Configure LCD_COLS, LCD_ROWS and BAUDRATE if desired/needed 19 | // Expected behavior of the sketch: 20 | // - characters received from serial port are displayed on LCD 21 | // - CR and LF are ignored/dropped 22 | // 23 | // If initialization of the LCD fails and the arduino supports a built in LED, 24 | // the sketch will simply blink the built in LED with the initalization error 25 | // code. 26 | // 27 | // Some 16x1 displays are actually a 8x2 display that have both lines on 28 | // a single line on the display. 29 | // If you have one of these displays, simply set the geometry to 8x2 instead 30 | // of 16x1. 31 | 32 | #include // optional, include to use h/w spi 33 | #include // main hd44780 header 34 | #include // Noritake CU-U serial i/o class header 35 | 36 | // constructor parameters: 37 | // lcd([cs], [clock, data]) 38 | // If no parameters, then library will use SS, SCK, and MOSI pins 39 | // If cs parameter specified, then use it for chip select then SCK and MOSI 40 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 41 | // h/w spi will be used 42 | // If h/w spi is not possible, then the code will fall back to bit banging. 43 | // 44 | // NOTE: 45 | // - Leonardo h/w is "stupid" and does not bring out SS 46 | // (it only drives an LED) 47 | // - Leonardo does not bring SPI signals to female headers, 48 | // they are only on 6 pin ISP header. 49 | // - ESP8266 is does not use naked constants for digital pin numbers 50 | // 51 | // 52 | // To work around these pin issues in this sketch, 53 | // Leonardo will use uno digital pins for SPI h/w which means it will 54 | // not use h/w spi. All the other boards will use the h/w SPI pins. 55 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 56 | // 57 | 58 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 59 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 60 | #else 61 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 62 | #endif 63 | hd44780_NTCUUserial lcd(cs, clk, data); // declare lcd object 64 | 65 | 66 | // LCD geometry 67 | const int LCD_COLS = 16; 68 | const int LCD_ROWS = 2; 69 | 70 | const int BAUDRATE = 9600; 71 | 72 | void setup() 73 | { 74 | int status; 75 | 76 | // initalize Serial port 77 | Serial.begin(BAUDRATE); 78 | 79 | // initialize LCD with number of columns and rows: 80 | // hd44780 returns a status from begin() that can be used 81 | // to determine if initalization failed. 82 | // the actual status codes are defined in 83 | status = lcd.begin(LCD_COLS, LCD_ROWS); 84 | if(status) // non zero status means it was unsuccesful 85 | { 86 | // begin() failed 87 | 88 | Serial.print("LCD initalization failed: "); 89 | Serial.println(status); 90 | 91 | // blink error code using the onboard LED if possible 92 | hd44780::fatalError(status); // does not return 93 | } 94 | 95 | // turn on automatic line wrapping 96 | // which automatically wraps lines to the next lower line and wraps back 97 | // to the top when at the bottom line 98 | // NOTE: 99 | // noLineWrap() can be used to disable automatic line wrapping. 100 | // _write() can be called instead of write() to send data bytes 101 | // to the display bypassing any special character or line wrap processing. 102 | lcd.lineWrap(); 103 | 104 | lcd.print("Serial2LCD"); 105 | if(LCD_ROWS > 1) 106 | { 107 | lcd.setCursor(0,1); 108 | lcd.print("Baud:"); 109 | lcd.print(BAUDRATE); 110 | } 111 | } 112 | 113 | void loop() 114 | { 115 | 116 | // check to see if characters available 117 | // indicating a message is coming in 118 | if (Serial.available()) 119 | { 120 | // wait some time for rest of message to arrive 121 | delay(100); 122 | 123 | // Clear the display before showing the new message 124 | lcd.clear(); 125 | 126 | // print the message on the LCD 127 | while (Serial.available() > 0) 128 | { 129 | char c; 130 | c = Serial.read(); 131 | if(c != '\r' && c != '\n') // drop CR and LF characters 132 | lcd.write(c); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCUUserial/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDcharset - Display LCD character set for hd44780 hd44780_NTCUUserial i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDcharset. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDcharset/LCDcharset.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDcharset 16 | // 17 | 18 | #include // optional, include to use h/w spi 19 | #include // main hd44780 header 20 | #include // Noritake CU-U serial i/o class header 21 | 22 | // define the LCD geometry 23 | #define LCD_COLS 16 24 | #define LCD_ROWS 2 25 | 26 | // constructor parameters: 27 | // lcd([cs], [clock, data]) 28 | // If no parameters, then library will use SS, SCK, and MOSI pins 29 | // If cs parameter specified, then use it for chip select then SCK and MOSI 30 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 31 | // h/w spi will be used 32 | // If h/w spi is not possible, then the code will fall back to bit banging. 33 | // 34 | // NOTE: 35 | // - Leonardo h/w is "stupid" and does not bring out SS 36 | // (it only drives an LED) 37 | // - Leonardo does not bring SPI signals to female headers, 38 | // they are only on 6 pin ISP header. 39 | // - ESP8266 is does not use naked constants for digital pin numbers 40 | // 41 | // 42 | // To work around these pin issues in this sketch, 43 | // Leonardo will use uno digital pins for SPI h/w which means it will 44 | // not use h/w spi. All the other boards will use the h/w SPI pins. 45 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 46 | // 47 | 48 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 49 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 50 | #else 51 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 52 | #endif 53 | hd44780_NTCUUserial lcd(cs, clk, data); // declare lcd object 54 | 55 | // tell the hd44780 sketch the lcd object has been declared 56 | #define HD44780_LCDOBJECT 57 | 58 | // include the hd44780 library LCDcharset sketch source code 59 | #include 60 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCUUserial/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include // optional, include to use h/w spi 19 | #include // main hd44780 header 20 | #include // Noritake CU-U serial i/o class header 21 | 22 | // constructor parameters: 23 | // lcd([cs], [clock, data]) 24 | // If no parameters, then library will use SS, SCK, and MOSI pins 25 | // If cs parameter specified, then use it for chip select then SCK and MOSI 26 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 27 | // h/w spi will be used 28 | // If h/w spi is not possible, then the code will fall back to bit banging. 29 | // 30 | // NOTE: 31 | // - Leonardo h/w is "stupid" and does not bring out SS 32 | // (it only drives an LED) 33 | // - Leonardo does not bring SPI signals to female headers, 34 | // they are only on 6 pin ISP header. 35 | // - ESP8266 is does not use naked constants for digital pin numbers 36 | // 37 | // 38 | // To work around these pin issues in this sketch, 39 | // Leonardo will use uno digital pins for SPI h/w which means it will 40 | // not use h/w spi. All the other boards will use the h/w SPI pins. 41 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 42 | // 43 | 44 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 45 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 46 | #else 47 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 48 | #endif 49 | hd44780_NTCUUserial lcd(cs, clk, data); // declare lcd object 50 | 51 | // tell the hd44780 sketch the lcd object has been declared 52 | #define HD44780_LCDOBJECT 53 | 54 | // include the hd44780 library LCDiSpeed sketch source code 55 | #include 56 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCUUserial/hd44780examples/LCDlibTest/LCDlibTest.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include // optional, include to use h/w spi 19 | #include // main hd44780 header 20 | #include // Noritake CU-U serial i/o class header 21 | 22 | // constructor parameters: 23 | // lcd([cs], [clock, data]) 24 | // If no parameters, then library will use SS, SCK, and MOSI pins 25 | // If cs parameter specified, then use it for chip select then SCK and MOSI 26 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 27 | // h/w spi will be used 28 | // If h/w spi is not possible, then the code will fall back to bit banging. 29 | // 30 | // NOTE: 31 | // - Leonardo h/w is "stupid" and does not bring out SS 32 | // (it only drives an LED) 33 | // - Leonardo does not bring SPI signals to female headers, 34 | // they are only on 6 pin ISP header. 35 | // - ESP8266 is does not use naked constants for digital pin numbers 36 | // 37 | // 38 | // To work around these pin issues in this sketch, 39 | // Leonardo will use uno digital pins for SPI h/w which means it will 40 | // not use h/w spi. All the other boards will use the h/w SPI pins. 41 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 42 | // 43 | 44 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 45 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 46 | #else 47 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 48 | #endif 49 | hd44780_NTCUUserial lcd(cs, clk, data); // declare lcd object 50 | 51 | // tell the hd44780 sketch the lcd object has been declared 52 | #define HD44780_LCDOBJECT 53 | 54 | // include the hd44780 library sketch source code 55 | #include 56 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_NTCUUserial/hd44780examples/lcdproc/lcdproc.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include // optional, include to use h/w spi 19 | #include // main hd44780 header 20 | #include // Noritake CU-U serial i/o class header 21 | 22 | // constructor parameters: 23 | // lcd([cs], [clock, data]) 24 | // If no parameters, then library will use SS, SCK, and MOSI pins 25 | // If cs parameter specified, then use it for chip select then SCK and MOSI 26 | // If is included and clock & data pins match h/w SPI pins SCK and MOSI, 27 | // h/w spi will be used 28 | // If h/w spi is not possible, then the code will fall back to bit banging. 29 | // 30 | // NOTE: 31 | // - Leonardo h/w is "stupid" and does not bring out SS 32 | // (it only drives an LED) 33 | // - Leonardo does not bring SPI signals to female headers, 34 | // they are only on 6 pin ISP header. 35 | // - ESP8266 is does not use naked constants for digital pin numbers 36 | // 37 | // 38 | // To work around these pin issues in this sketch, 39 | // Leonardo will use uno digital pins for SPI h/w which means it will 40 | // not use h/w spi. All the other boards will use the h/w SPI pins. 41 | // Consult board pinout diagram to see where SS, SCK, and MOSI are available. 42 | // 43 | 44 | #if defined(ARDUINO_AVR_LEONARDO) || ( (USB_VID == 0x2341) && (USB_PID == 0x8036) ) 45 | const int cs=10, clk=13, data=11; // uno SPI pins (s/w bit banging will be used) 46 | #else 47 | const int cs=SS, clk=SCK, data=MOSI; // use h/w SPI pins on all other boards 48 | #endif 49 | hd44780_NTCUUserial lcd(cs, clk, data); // declare lcd object 50 | 51 | // tell the hd44780 sketch the lcd object has been declared 52 | #define HD44780_LCDOBJECT 53 | 54 | // include the hd44780 library sketch source code 55 | #include 56 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_pinIO/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | // vi:ts=4 2 | // ---------------------------------------------------------------------------- 3 | // HelloWorld - simple demonstration of lcd 4 | // Created by Bill Perry 2016-07-02 5 | // bperrybap@opensource.billsworld.billandterrie.com 6 | // 7 | // This example code is unlicensed and is released into the public domain 8 | // ---------------------------------------------------------------------------- 9 | // 10 | // This sketch is for LCDs that are directly controlled with Arduino pins. 11 | // 12 | // Sketch prints "Hello, World!" on the lcd 13 | // 14 | // See below for configuring the Arduino pins used. 15 | // 16 | // While not all hd44780 use the same pinout, here is the one that most use: 17 | // pin 1 is the pin closest to the edge of the PCB 18 | // 1 - LCD gnd 19 | // 2 - VCC (5v) 20 | // 3 - Vo Contrast Voltage 21 | // 4 - RS Register Select (rs) 22 | // 5 - Read/Write 23 | // 6 - Enable (en) 24 | // 7 - Data 0 (db0) ---- 25 | // 8 - Data 1 (db1) |-------- Not used in 4 bit mode 26 | // 9 - Data 2 (db2) | 27 | // 10 - Data 3 (db3) ---- 28 | // 11 - Data 4 (db4) 29 | // 12 - Data 5 (db5) 30 | // 13 - Data 6 (db6) 31 | // 14 - Data 7 (db7) 32 | // 15 - Backlight Anode (+5v) 33 | // 16 - Backlight Cathode (Gnd) 34 | // 35 | // ---------------------------------------------------------------------------- 36 | // LiquidCrystal compability: 37 | // Since hd44780 is LiquidCrystal API compatible, most existing LiquidCrystal 38 | // sketches should work with hd44780 hd44780_pinIO i/o class once the 39 | // includes are changed to use hd44780 and the lcd object constructor is 40 | // changed to use the hd44780_pinIO class. 41 | 42 | #include 43 | #include // Arduino pin i/o class header 44 | 45 | // declare Arduino pins used for LCD functions 46 | // and the lcd object 47 | 48 | // Note: this can be with or without backlight control: 49 | 50 | // without backlight control: 51 | // The parameters used by hd44780_pinIO are the same as those used by 52 | // the IDE bundled LiquidCrystal library 53 | // note that ESP8266 based arduinos must use the Dn defines rather than 54 | // raw pin numbers. 55 | #if defined (ARDUINO_ARCH_ESP8266) 56 | // esp8266 Lolin/Wemos D1 R1 (uno form factor) 57 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; 58 | #elif defined(ARDUINO_ARCH_ESP32) 59 | // esp32 espduino32 D1 R32 (uno form factor) 60 | // note: GPIO12 needs a pulldown resistor 61 | const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14; 62 | #else 63 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // for all other devices 64 | #endif 65 | hd44780_pinIO lcd(rs, en, db4, db5, db6, db7); 66 | 67 | //with backlight control: 68 | // backlight control requires two additional parameters 69 | // - an additional pin to control the backlight 70 | // - backlight active level which tells the library the level 71 | // needed to turn on the backlight. 72 | // note: If the backlight control pin supports PWM, dimming can be done 73 | // using setBacklight(dimvalue); 74 | // 75 | // WARNING: some lcd keypads have a broken backlight circuit 76 | // If you have a lcd keypad, it is recommended that you first run the 77 | // LCDKeypadCheck sketch to verify that the backlight circuitry 78 | // is ok before enabling backlight control. 79 | // However, the hd44780_PinIO class will autodetect the issue and 80 | // work around it in s/w. If the backlight circuitry is broken, 81 | // dimming will not be possible even if the backlight pin supports PWM. 82 | // 83 | #if defined (ARDUINO_ARCH_ESP8266) 84 | // esp8266 Lolin/Wemos D1 R1 (uno form factor) 85 | //const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7, bl=D10, blLevel=HIGH; 86 | #elif defined(ARDUINO_ARCH_ESP32) 87 | // esp32 espduino32 D1 R32 (uno form factor) 88 | // note: GPIO12 needs a pulldown resistor 89 | // Dimming will not work on esp32 as it does not have analogWrite() 90 | //const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14, bl=5, blLevel=HIGH; 91 | #else 92 | //const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7, bl=10, blLevel=HIGH; 93 | #endif 94 | //hd44780_pinIO lcd(rs, en, db4, db5, db6, db7, bl, blLevel); 95 | 96 | // LCD geometry 97 | const int LCD_COLS = 16; 98 | const int LCD_ROWS = 2; 99 | 100 | void setup() 101 | { 102 | // initialize LCD with number of columns and rows: 103 | // 104 | // note: 105 | // begin() will automatically turn on the backlight if backlight 106 | // control is specified in the lcd object constructor 107 | // 108 | lcd.begin(LCD_COLS, LCD_ROWS); 109 | 110 | // if backlight control was specified, the backlight should be on now 111 | 112 | // Print a message to the LCD 113 | lcd.print("Hello, World!"); 114 | } 115 | 116 | void loop() {} 117 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_pinIO/README.md: -------------------------------------------------------------------------------- 1 | hd44780_pinIO examples 2 | ======================= 3 | 4 | The examples included in this directory are for the hd44780_pinIO i/o class.
5 | The hd44780_pinIO i/o class is used to control an LCD using direct Arduino pin connections. 6 | 7 | #### The following examples are included: 8 | 9 | - `HelloWorld`
10 | Prints "Hello, World!" on the lcd 11 | 12 | - `LCDKeypadCheck`
13 | Tests lcd keypad shields for bad backlight circuitry 14 | 15 | - `LCDCustomChars`
16 | Demonstrates using custom characters 17 | 18 | - `LineWrap`
19 | Demonstrates automatic linewrap functionality 20 | 21 | - `ReadWrite`
22 | Demonstrate the ability to read data from the LCD. 23 | 24 | - `Serial2LCD`
25 | Displays a message read from the serial port on the lcd. 26 | 27 | - `UpTime`
28 | Prints the amount of time since the Arduino has been reset. 29 | 30 | - `hd44780examples`
31 | The hd44780examples subdirectory contains 32 | hd44780_pinIO class specific wrapper sketches for sketches under 33 | examples/hd44780examples. 34 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_pinIO/hd44780examples/LCDcharset/LCDcharset.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDcharset - Display LCD character set for hd44780 hd44780_pinIO i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDcharset. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDcharset/LCDcharset.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDcharset 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // define the LCD geometry 22 | #define LCD_COLS 16 23 | #define LCD_ROWS 2 24 | 25 | // declare Arduino pins used for LCD functions 26 | // and the lcd object 27 | 28 | // Note: this can be with or without backlight control: 29 | 30 | // without backlight control: 31 | // note that ESP8266 based arduinos must use the Dn defines rather than 32 | // raw pin numbers. 33 | #if defined (ARDUINO_ARCH_ESP8266) 34 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // esp8266 Lolin/Wemos D1 R1 (uno form factor) 35 | #elif defined(ARDUINO_ARCH_ESP32) 36 | // note: GPIO12 needs a pulldown resistor 37 | const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14; // esp32 espduino32 D1 R32 (uno form factor) 38 | #else 39 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // for all other devices 40 | #endif 41 | hd44780_pinIO lcd(rs, en, db4, db5, db6, db7); 42 | 43 | //with backlight control: 44 | // backlight control requires two additional parameters 45 | // - an additional pin to control the backlight 46 | // - backlight active level which tells the library the level 47 | // needed to turn on the backlight. 48 | // note: If the backlight control pin supports PWM, dimming can be done 49 | // using setBacklight(dimvalue); 50 | // 51 | // WARNING: some lcd keypads have a broken backlight circuit 52 | // If you have a lcd keypad, it is recommended that you first run the 53 | // LCDKeypadCheck sketch to verify that the backlight circuitry 54 | // is ok before enabling backlight control. 55 | // However, the hd44780_PinIO class will autodetect the issue and 56 | // work around it in s/w. If the backlight circuitry is broken, 57 | // dimming will not be possible even if the backlight pin supports PWM. 58 | // 59 | #if defined (ARDUINO_ARCH_ESP8266) 60 | // esp8266 Lolin/Wemos D1 R1 (uno form factor) 61 | //const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7, bl=D10, blLevel=HIGH; 62 | #elif defined(ARDUINO_ARCH_ESP32) 63 | // esp32 espduino32 D1 R32 (uno form factor) 64 | // note: GPIO12 needs a pulldown resistor 65 | //const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14, bl=5, blLevel=HIGH; 66 | #else 67 | //const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7, bl=10, blLevel=HIGH; 68 | #endif 69 | //hd44780_pinIO lcd(rs, en, db4, db5, db6, db7, bl, blLevel); 70 | 71 | // tell the hd44780 sketch the lcd object has been declared 72 | #define HD44780_LCDOBJECT 73 | 74 | // include the hd44780 library LCDcharset sketch source code 75 | #include 76 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_pinIO/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for hd44780 hd44780_pinIO i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // declare Arduino pins used for LCD functions 22 | // and the lcd object 23 | 24 | // Note: this can be with or without backlight control: 25 | 26 | // without backlight control: 27 | // note that ESP8266 based arduinos must use the Dn defines rather than 28 | // raw pin numbers. 29 | #if defined (ARDUINO_ARCH_ESP8266) 30 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // esp8266 Lolin/Wemos D1 R1 (uno form factor) 31 | #elif defined(ARDUINO_ARCH_ESP32) 32 | // note: GPIO12 needs a pulldown resistor 33 | const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14; // esp32 espduino32 D1 R32 (uno form factor) 34 | #else 35 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // for all other devices 36 | #endif 37 | hd44780_pinIO lcd(rs, en, db4, db5, db6, db7); 38 | 39 | //with backlight control: 40 | // backlight control requires two additional parameters 41 | // - an additional pin to control the backlight 42 | // - backlight active level which tells the library the level 43 | // needed to turn on the backlight. 44 | // note: If the backlight control pin supports PWM, dimming can be done 45 | // using setBacklight(dimvalue); 46 | // 47 | // WARNING: some lcd keypads have a broken backlight circuit 48 | // If you have a lcd keypad, it is recommended that you first run the 49 | // LCDKeypadCheck sketch to verify that the backlight circuitry 50 | // is ok before enabling backlight control. 51 | // However, the hd44780_PinIO class will autodetect the issue and 52 | // work around it in s/w. If the backlight circuitry is broken, 53 | // dimming will not be possible even if the backlight pin supports PWM. 54 | // 55 | #if defined (ARDUINO_ARCH_ESP8266) 56 | // esp8266 Lolin/Wemos D1 R1 (uno form factor) 57 | //const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7, bl=D10, blLevel=HIGH; 58 | #elif defined(ARDUINO_ARCH_ESP32) 59 | // esp32 espduino32 D1 R32 (uno form factor) 60 | // note: GPIO12 needs a pulldown resistor 61 | //const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14, bl=5, blLevel=HIGH; 62 | #else 63 | //const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7, bl=10, blLevel=HIGH; 64 | #endif 65 | //hd44780_pinIO lcd(rs, en, db4, db5, db6, db7, bl, blLevel); 66 | 67 | // tell the hd44780 sketch the lcd object has been declared 68 | #define HD44780_LCDOBJECT 69 | 70 | // include the hd44780 library sketch source code 71 | #include 72 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_pinIO/hd44780examples/LCDlibTest/LCDlibTest.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDLibTest - LCD library test sketch for hd44780 hd44780_pinIO i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDlibTest/LCDlibTest.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDlibTest 16 | // 17 | 18 | #include 19 | #include // include i/o class header 20 | 21 | // declare Arduino pins used for LCD functions 22 | // and the lcd object 23 | 24 | // Note: this can be with or without backlight control: 25 | 26 | // without backlight control: 27 | #if defined (ARDUINO_ARCH_ESP8266) 28 | //const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // esp8266 Lolin/Wemos D1 R1 (uno form factor) 29 | #elif defined(ARDUINO_ARCH_ESP32) 30 | // esp32 espduino32 D1 R32 (uno form factor) 31 | // note: espduino32 GPIO12 needs a pulldown resistor 32 | //const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14; 33 | #else 34 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal pins 35 | //const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 36 | 37 | #endif 38 | //hd44780_pinIO lcd(rs, en, db4, db5, db6, db7); 39 | 40 | #if defined (ARDUINO_ARCH_ESP8266) 41 | // esp8266 Lolin/Wemos D1 R1 (uno form factor) 42 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7, bl=D10, blLevel=HIGH; 43 | #elif defined(ARDUINO_ARCH_ESP32) 44 | // esp32 espduino32 D1 R32 (uno form factor) 45 | // note: GPIO12 needs a pulldown resistor 46 | const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14, bl=5, blLevel=HIGH; 47 | #else 48 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7, bl=10, blLevel=HIGH; 49 | #endif 50 | hd44780_pinIO lcd(rs, en, db4, db5, db6, db7, bl, blLevel); 51 | 52 | // tell the hd44780 sketch the lcd object has been declared 53 | #define HD44780_LCDOBJECT 54 | 55 | // include the hd44780 library sketch source code 56 | #include 57 | -------------------------------------------------------------------------------- /examples/ioClass/hd44780_pinIO/hd44780examples/lcdproc/lcdproc.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // lcdproc - LCD library lcdproc wrapper sketch for hd44780_pinIO i/o class 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or exmaple 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/lcdproc/lcdproc.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/lcdproc 16 | // 17 | 18 | #include 19 | #include // include i/o class header 20 | 21 | // declare Arduino pins used for LCD functions 22 | // and the lcd object 23 | 24 | // Note: this can be with or without backlight control: 25 | 26 | // without backlight control: 27 | #if defined (ARDUINO_ARCH_ESP8266) 28 | const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7; // esp8266 Lolin/Wemos D1 R1 (uno form factor) 29 | #elif defined(ARDUINO_ARCH_ESP32) 30 | // note: GPIO12 needs a pulldown resistor 31 | const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14; // esp32 espduino32 D1 R32 (uno form factor) 32 | #else 33 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // for all other devices 34 | #endif 35 | hd44780_pinIO lcd(rs, en, db4, db5, db6, db7); 36 | 37 | //with backlight control: 38 | // backlight control requires two additional parameters 39 | // - an additional pin to control the backlight 40 | // - backlight active level which tells the library the level 41 | // needed to turn on the backlight. 42 | // note: If the backlight control pin supports PWM, dimming can be done 43 | // using setBacklight(dimvalue); 44 | // 45 | // WARNING: some lcd keypads have a broken backlight circuit 46 | // If you have a lcd keypad, it is recommended that you first run the 47 | // LCDKeypadCheck sketch to verify that the backlight circuitry 48 | // is ok before enabling backlight control. 49 | // However, the hd44780_PinIO class will autodetect the issue and 50 | // work around it in s/w. If the backlight circuitry is broken, 51 | // dimming will not be possible even if the backlight pin supports PWM. 52 | // 53 | #if defined (ARDUINO_ARCH_ESP8266) 54 | // esp8266 Lolin/Wemos D1 R1 (uno form factor) 55 | //const int rs=D8, en=D9, db4=D4, db5=D5, db6=D6, db7=D7, bl=D10, blLevel=HIGH; 56 | #elif defined(ARDUINO_ARCH_ESP32) 57 | // esp32 espduino32 D1 R32 (uno form factor) 58 | // note: GPIO12 needs a pulldown resistor 59 | //const int rs=12, en=13, db4=17, db5=16, db6=27, db7=14, bl=5, blLevel=HIGH; 60 | #else 61 | //const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7, bl=10, blLevel=HIGH; 62 | #endif 63 | //hd44780_pinIO lcd(rs, en, db4, db5, db6, db7, bl, blLevel); 64 | 65 | // tell the hd44780 sketch the lcd object has been declared 66 | #define HD44780_LCDOBJECT 67 | 68 | // include the hd44780 library sketch source code 69 | #include 70 | -------------------------------------------------------------------------------- /examples/otherLibraries/Adafruit_LiquidCrystal/4bit/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for AdaFruit_LiquidCrystal in 4bit mode 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | 20 | // ugliness to allow this sketch to locate the hd44780 example sketch 21 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 22 | #include 23 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 24 | 25 | // cols and rows don't have to be exact to still get accurate transfer numbers 26 | #define LCD_COLS 16 27 | #define LCD_ROWS 2 28 | 29 | // declare Arduino pins used for LCD functions 30 | // and the lcd object 31 | 32 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // pins used by IDE LiquidCrystal examples 33 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 34 | Adafruit_LiquidCrystal lcd(rs, en, db4, db5, db6, db7); 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/otherLibraries/Adafruit_LiquidCrystal/I2C/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for Adafruit_LiquidCrystal using i2c 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // ugliness to allow this sketch to locate the hd44780 example sketch 22 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 23 | #include 24 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 25 | 26 | // cols and rows don't have to be exact to still get accurate transfer numbers 27 | #define LCD_COLS 16 28 | #define LCD_ROWS 2 29 | 30 | // declare the lcd object 31 | // Note: The i2c address must match the backpack address 32 | // and the library only works with the MCP23008 based #292 backpack 33 | const uint8_t i2cAddr = 0; // default i2c address for #292 board 34 | Adafruit_LiquidCrystal lcd(i2cAddr); 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // include the hd44780 library LCDiSpeed sketch source code 40 | #include 41 | -------------------------------------------------------------------------------- /examples/otherLibraries/Adafruit_LiquidCrystal/I2C/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for Adafruit_LiquidCrystal using i2c 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // ugliness to allow this sketch to locate the hd44780 example sketch 22 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 23 | #include 24 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 25 | 26 | #if ARDUINO < 157 27 | #error "This sketch Requires Arduino 1.5.7 or higher" 28 | #endif 29 | 30 | // NOTE: uses API that only works on IDE 1.5.7 and up 31 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 32 | 33 | // cols and rows don't have to be exact to still get accurate transfer numbers 34 | #define LCD_COLS 16 35 | #define LCD_ROWS 2 36 | 37 | // declare the lcd object 38 | // Note: The i2c address must match the backpack address 39 | // and the library only works with the MCP23008 based #292 backpack 40 | const uint8_t i2cAddr = 0; // default i2c address for #292 board 41 | Adafruit_LiquidCrystal lcd(i2cAddr); 42 | 43 | // tell the hd44780 sketch the lcd object has been declared 44 | #define HD44780_LCDOBJECT 45 | 46 | // include the hd44780 library LCDiSpeed sketch source code 47 | #include 48 | -------------------------------------------------------------------------------- /examples/otherLibraries/Adafruit_LiquidCrystal/README.md: -------------------------------------------------------------------------------- 1 | Adafruit_LiquidCrystal hd44780 examples 2 | ======================================== 3 | 4 | The Adafruit_LiquidCrystal library must be installed in order to use these sketches. 5 | 6 | #### The examples are broken up into various sub directories. 7 | 8 | * `4bit`
9 | Contains example sketches that are for LCDs that are wired up directly to Arduino pins. 10 | 11 | * `I2C`
12 | 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. 13 | 14 | * `SPI`
15 | Contains example sketches that are for LCDs connected to an Adafruit #292 backpack when using the shift register to control the LCD. 16 | 17 | Note: that while adafruit uses the term "SPI" the #292 backpack it is not using SPI. 18 | It is mearly using a shift register. 19 | 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. 20 | -------------------------------------------------------------------------------- /examples/otherLibraries/Adafruit_LiquidCrystal/SPI/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for Adafruit_LiquidCrystal shiftreg mode 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // ugliness to allow this sketch to locate the hd44780 example sketch 22 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 23 | #include 24 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 25 | 26 | 27 | // declare the lcd object for shift register mode 28 | const uint8_t clkPin = 2; 29 | const uint8_t datPin = 3; 30 | const uint8_t latPin = 4; 31 | Adafruit_LiquidCrystal lcd(datPin, clkPin, latPin); 32 | 33 | // tell the hd44780 sketch the lcd object has been declared 34 | #define HD44780_LCDOBJECT 35 | 36 | // include the hd44780 library LCDiSpeed sketch source code 37 | #include 38 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal/README.md: -------------------------------------------------------------------------------- 1 | LiquidCrystal hd44780 examples 2 | ============================== 3 | 4 | The LiquidCrystal library comes bundled with the IDE. 5 | It controls the LCD using Arduino pins directly connected to the LCD. 6 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | 20 | // ugliness to allow this sketch to locate the hd44780 example sketch 21 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 22 | #include 23 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 24 | 25 | // cols and rows don't have to be exact to still get accurate transfer numbers 26 | #define LCD_COLS 16 27 | #define LCD_ROWS 2 28 | 29 | // declare Arduino pins used for LCD functions and the lcd object 30 | 31 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins 32 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 33 | LiquidCrystal lcd(rs, en, db4, db5, db6, db7); 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystalFast/LiquidCrystalFastRW/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | 20 | // ugliness to allow this sketch to locate the hd44780 example sketch 21 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 22 | #include 23 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 24 | 25 | // cols and rows don't have to be exact to still get accurate transfer numbers 26 | #define LCD_COLS 16 27 | #define LCD_ROWS 2 28 | 29 | // declare Arduino pins used for LCD functions and the lcd object 30 | 31 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins 32 | const int rs=8, rw=3, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 33 | LiquidCrystalFast lcd(rs, rw, en, db4, db5, db6, db7); 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystalFast/LiquidCrystalFastnoRW/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | 20 | // ugliness to allow this sketch to locate the hd44780 example sketch 21 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 22 | #include 23 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 24 | 25 | // cols and rows don't have to be exact to still get accurate transfer numbers 26 | #define LCD_COLS 16 27 | #define LCD_ROWS 2 28 | 29 | // declare Arduino pins used for LCD functions and the lcd object 30 | 31 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins 32 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 33 | LiquidCrystalFast lcd(rs, en, db4, db5, db6, db7); 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystalFast/README.md: -------------------------------------------------------------------------------- 1 | LiquidCrystalFast hd44780 examples 2 | ================================= 3 | 4 | LiquidCrystalFast library must be installed in order to use these sketches.
5 | 6 | #### The examples are broken up into sub directories for with/without R/W pin 7 | 8 | * `LiquidCrystalFastnoRW`
9 | Contains example sketches that are for LCDs that are wired up directly to Arduino pins without the R/W pin 10 | 11 | * `LiquidCrystalFastRW`
12 | Contains example sketches that are for LCDs that are wired up directly to Arduino pins with the R/W pin 13 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystalIO/README.md: -------------------------------------------------------------------------------- 1 | LiquidCrytsalIO hd44780 examples 2 | ================================= 3 | 4 | LiquidCrystalIO and IoAbstration libraries must be installed in order to use these sketches.
5 | The liquidCrystalIO library contains multiple i/o classes. 6 | 7 | 8 | #### The examples are broken up into various sub directories for each i/o class 9 | 10 | * `ioUsingArduino`
11 | Contains example sketches that are for LCDs that are wired up directly to Arduino pins. 12 | 13 | * `iofrom8574`
14 | Contains example sketches that are for LCDs connected to a backpack using the i2c PCF8574 i/o expander chip to control the LCD. 15 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystalIO/ioFrom8574/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test: LiquidCrystalIO with ioFrom8574 3 | // ---------------------------------------------------------------------------- 4 | // NOTE: this also requires the IoAbstration library 5 | // 6 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 7 | // Note: 8 | // This is not a normal sketch and should not be used as model or example 9 | // of hd44780 library sketches. 10 | // This sketch is simple wrapper that declares the needed lcd object for the 11 | // hd44780 library sketch. 12 | // It is provided as a convenient way to run a pre-configured sketch for 13 | // the i/o class. 14 | // The source code for this sketch lives in hd44780 examples: 15 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 16 | // From IDE: 17 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 18 | // 19 | 20 | #include // bundled Wire library 21 | #include // from IoAbstration library 22 | #include // from LiquidCrystalIO library 23 | 24 | // ugliness to allow this sketch to locate the hd44780 example sketch 25 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 26 | #include 27 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 28 | 29 | // cols and rows don't have to be exact to still get accurate transfer numbers 30 | #define LCD_COLS 16 31 | #define LCD_ROWS 2 32 | 33 | // declare the lcd object 34 | // Note: The i2c address and pin mappings must match the backpack 35 | // The pin mapping selected matches the "LiquidCrystal_I2C" library 36 | // in the IDE library manager. 37 | const uint8_t i2cAddr = 0x27; 38 | const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3; 39 | LiquidCrystal lcd(rs, rw, en, db4, db5, db6, db7, ioFrom8574(i2cAddr)); 40 | 41 | // tell the hd44780 sketch the lcd object has been declared 42 | #define HD44780_LCDOBJECT 43 | 44 | // tell lcd hd44780 sketch to call Wire.begin() 45 | #define LCDISPEED_CALL_WIRE_BEGIN 46 | 47 | // tell lcd hd44780 sketch to call custom customLCDinit() for initialization 48 | #define LCDISPEED_CALL_CUSTOM_LCDINIT 49 | 50 | void custom_LCDinit(void); 51 | // include the hd44780 library LCDiSpeed sketch source code 52 | #include 53 | 54 | // have to use custom initialzation for this library 55 | void custom_LCDinit(void) 56 | { 57 | Wire.begin(); 58 | lcd.configureBacklightPin(bl); // assumes active HIGH 59 | lcd.begin(LCD_COLS, LCD_ROWS); 60 | lcd.backlight(); 61 | } 62 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystalIO/ioFrom8574/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test: LiquidCrystalIO with ioFrom8574 3 | // ---------------------------------------------------------------------------- 4 | // NOTE: this also requires the IoAbstration library 5 | // 6 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 7 | // Note: 8 | // This is not a normal sketch and should not be used as model or example 9 | // of hd44780 library sketches. 10 | // This sketch is simple wrapper that declares the needed lcd object for the 11 | // hd44780 library sketch. 12 | // It is provided as a convenient way to run a pre-configured sketch for 13 | // the i/o class. 14 | // The source code for this sketch lives in hd44780 examples: 15 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 16 | // From IDE: 17 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 18 | // 19 | 20 | #include // bundled Wire library 21 | #include // from IoAbstration library 22 | #include // from LiquidCrystalIO library 23 | 24 | // ugliness to allow this sketch to locate the hd44780 example sketch 25 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 26 | #include 27 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 28 | 29 | #if ARDUINO < 157 30 | #error "This sketch Requires Arduino 1.5.7 or higher" 31 | #endif 32 | 33 | // NOTE: uses API that only works on IDE 1.5.7 and up 34 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 35 | 36 | // cols and rows don't have to be exact to still get accurate transfer numbers 37 | #define LCD_COLS 16 38 | #define LCD_ROWS 2 39 | 40 | // declare the lcd object 41 | // Note: The i2c address and pin mappings must match the backpack 42 | // The pin mapping selected matches the "LiquidCrystal_I2C" library 43 | // in the IDE library manager. 44 | const uint8_t i2cAddr = 0x27; 45 | const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3; 46 | LiquidCrystal lcd(rs, rw, en, db4, db5, db6, db7, ioFrom8574(i2cAddr)); 47 | 48 | // tell the hd44780 sketch the lcd object has been declared 49 | #define HD44780_LCDOBJECT 50 | 51 | // tell lcd hd44780 sketch to call Wire.begin() 52 | #define LCDISPEED_CALL_WIRE_BEGIN 53 | 54 | // tell lcd hd44780 sketch to call custom customLCDinit() for initialization 55 | #define LCDISPEED_CALL_CUSTOM_LCDINIT 56 | 57 | void custom_LCDinit(void); 58 | // include the hd44780 library LCDiSpeed sketch source code 59 | #include 60 | 61 | // have to use custom initialzation for this library 62 | void custom_LCDinit(void) 63 | { 64 | Wire.begin(); 65 | lcd.configureBacklightPin(bl); // assumes active HIGH 66 | lcd.begin(LCD_COLS, LCD_ROWS); 67 | lcd.backlight(); 68 | } 69 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystalIO/ioUsingArduino/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test: LiquidCrystalIO with ioUsingArduino 3 | // ---------------------------------------------------------------------------- 4 | // NOTE: this also requires the IoAbstration library 5 | // 6 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 7 | // Note: 8 | // This is not a normal sketch and should not be used as model or example 9 | // of hd44780 library sketches. 10 | // This sketch is simple wrapper that declares the needed lcd object for the 11 | // hd44780 library sketch. 12 | // It is provided as a convenient way to run a pre-configured sketch for 13 | // the i/o class. 14 | // The source code for this sketch lives in hd44780 examples: 15 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 16 | // From IDE: 17 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 18 | // 19 | 20 | #include // from LiquidCrystalIO library 21 | 22 | // ugliness to allow this sketch to locate the hd44780 example sketch 23 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 24 | #include 25 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 26 | 27 | // cols and rows don't have to be exact to still get accurate transfer numbers 28 | #define LCD_COLS 16 29 | #define LCD_ROWS 2 30 | 31 | // declare Arduino pins used for LCD functions and the lcd object 32 | // this will use 4 bit mode using Arduino pins 33 | 34 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // IDE LiquidCrystal example pins 35 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 36 | LiquidCrystal lcd(rs, en, db4, db5, db6, db7); 37 | 38 | // tell the hd44780 sketch the lcd object has been declared 39 | #define HD44780_LCDOBJECT 40 | 41 | void custom_LCDinit(void); 42 | // include the hd44780 library LCDiSpeed sketch source code 43 | #include 44 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal_I2C/README.md: -------------------------------------------------------------------------------- 1 | LiquidCrystal_I2C hd44780 examples 2 | ================================== 3 | 4 | These examples require that the LiquidCrystal_I2C library be installed. 5 | 6 | The LiquidCrystal_I2C library can be installed using the IDE library manager. 7 | It controls the LCD using an PCF8574 i/o expander backpack. 8 | The library assumes a paticular wiring between the PCF8574 and the LCD pins and a particular backlight circuit. 9 | ``` 10 | P0 - RS 11 | P1 - R/W 12 | P2 - E 13 | P3 - Backlight control (Active High) 14 | P4 - DB4 15 | P5 - DB5 16 | P6 - DB6 17 | P7 - DB7 18 | ``` 19 | Not all backpacks are wired up this way. 20 | If the actual wiring or backlight circuit does not match what the library expects, the examples will not work. 21 | Also, the examples must be modified to set the i2c address to match the i2c address of the PCF8574 chip.
22 | **If the address in the sketch does not match the actual address of the chip, the example will not work**. 23 | 24 | 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. 25 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal_I2C/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for LiquidCrystal_I2C library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // ugliness to allow this sketch to locate the hd44780 example sketch 22 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 23 | #include 24 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 25 | 26 | 27 | // declare the lcd object 28 | // Note: The i2c address must match the backpack address 29 | // and the library only works with certain backpacks 30 | const uint8_t i2cAddr = 0x27; 31 | #define LCD_COLS 16 32 | #define LCD_ROWS 2 33 | LiquidCrystal_I2C lcd(i2cAddr, LCD_COLS, LCD_ROWS); 34 | 35 | // tell the hd44780 sketch the lcd object has been declared 36 | #define HD44780_LCDOBJECT 37 | 38 | // include the hd44780 library LCDiSpeed sketch source code 39 | #include 40 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal_I2C/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for LiquidCrystal_I2C library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // ugliness to allow this sketch to locate the hd44780 example sketch 22 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 23 | #include 24 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 25 | 26 | 27 | #if ARDUINO < 157 28 | #error "This sketch Requires Arduino 1.5.7 or higher" 29 | #endif 30 | 31 | // NOTE: uses API that only works on IDE 1.5.7 and up 32 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 33 | 34 | // declare the lcd object 35 | // Note: The i2c address must match the backpack address 36 | // and the library only works with certain backpacks 37 | const uint8_t i2cAddr = 0x27; 38 | #define LCD_COLS 16 39 | #define LCD_ROWS 2 40 | LiquidCrystal_I2C lcd(i2cAddr, LCD_COLS, LCD_ROWS); 41 | 42 | // tell the hd44780 sketch the lcd object has been declared 43 | #define HD44780_LCDOBJECT 44 | 45 | // include the hd44780 library LCDiSpeed sketch source code 46 | #include 47 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal_PCF8574/README.md: -------------------------------------------------------------------------------- 1 | LiquidCrystal_PCF8574 hd44780 examples 2 | ======================================= 3 | 4 | These examples require that the LiquidCrystal_PCF8574 library be installed. 5 | 6 | LiquidCrystal_PCF8574 library can be installed using the IDE library manager. 7 | It controls the LCD using an PCF8574 i/o expander backpack. 8 | The library assumes a paticular wiring between the PCF8574 and the LCD pins and a particular backlight circuit. 9 | ``` 10 | P0 - RS 11 | P1 - R/W 12 | P2 - E 13 | P3 - Backlight control (Active High) 14 | P4 - DB4 15 | P5 - DB5 16 | P6 - DB6 17 | P7 - DB7 18 | ``` 19 | Not all backpacks are wired up this way. 20 | If the actual wiring or backlight circuit does not match what the library expects, the examples will not work. 21 | Also, the examples must be modified to set the i2c address to match the i2c address of the PCF8574 chip.
22 | **If the address in the sketch does not match the actual address of the chip, the example will not work**. 23 | 24 | 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. 25 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal_PCF8574/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for LiquidCrystal_PCF8574 library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // ugliness to allow this sketch to locate the hd44780 example sketch 22 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 23 | #include 24 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 25 | 26 | // cols and rows don't have to be exact to still get accurate transfer numbers 27 | #define LCD_COLS 16 28 | #define LCD_ROWS 2 29 | 30 | // declare the lcd object 31 | // Note: The i2c address must match the backpack address 32 | // and the library only works with certain backpacks 33 | const uint8_t i2cAddr = 0x27; 34 | LiquidCrystal_PCF8574 lcd(i2cAddr); 35 | 36 | // tell the hd44780 sketch the lcd object has been declared 37 | #define HD44780_LCDOBJECT 38 | 39 | // tell lcd hd44780 sketch to call custom customLCDinit() for initialization 40 | #define LCDISPEED_CALL_CUSTOM_LCDINIT 41 | 42 | // have to use custom initialzation for this library 43 | void custom_LCDinit(void) 44 | { 45 | lcd.begin(LCD_COLS, LCD_ROWS); 46 | lcd.setBacklight(0xff); 47 | } 48 | 49 | // include the hd44780 library LCDiSpeed sketch source code 50 | #include 51 | -------------------------------------------------------------------------------- /examples/otherLibraries/LiquidCrystal_PCF8574/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for LiquidCrystal_PCF8574 library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | 21 | // ugliness to allow this sketch to locate the hd44780 example sketch 22 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 23 | #include 24 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 25 | 26 | #if ARDUINO < 157 27 | #error "This sketch Requires Arduino 1.5.7 or higher" 28 | #endif 29 | 30 | // NOTE: uses API that only works on IDE 1.5.7 and up 31 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 32 | 33 | // cols and rows don't have to be exact to still get accurate transfer numbers 34 | #define LCD_COLS 16 35 | #define LCD_ROWS 2 36 | 37 | // declare the lcd object 38 | // Note: The i2c address must match the backpack address 39 | // and the library only works with certain backpacks 40 | const uint8_t i2cAddr = 0x27; 41 | LiquidCrystal_PCF8574 lcd(i2cAddr); 42 | 43 | // tell the hd44780 sketch the lcd object has been declared 44 | #define HD44780_LCDOBJECT 45 | 46 | // tell lcd hd44780 sketch to call custom customLCDinit() for initialization 47 | #define LCDISPEED_CALL_CUSTOM_LCDINIT 48 | 49 | // have to use custom initialzation for this library 50 | void custom_LCDinit(void) 51 | { 52 | lcd.begin(LCD_COLS, LCD_ROWS); 53 | lcd.setBacklight(0xff); 54 | } 55 | 56 | // include the hd44780 library LCDiSpeed sketch source code 57 | #include 58 | -------------------------------------------------------------------------------- /examples/otherLibraries/NewLiquidCrystal/LiquidCrystal/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for NewLiquidCrystal library 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in the hd44780 examples. 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | // include LCD.h which is only in newLiquidCrystal 19 | // to force the IDE include path to use newLiquidCrystal instead 20 | // of LiquidCrystal 21 | // This works because even if the LiquidCrystal.h below causes the IDE to 22 | // add the bundled LiquidCrystal library for it, since the LCD.h will have 23 | // gotten the IDE to add the newLiquidCrystal library directory to the path 24 | // first. 25 | // 26 | #include 27 | 28 | #include 29 | 30 | // ugliness to allow this sketch to locate the hd44780 example sketch 31 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 32 | #include 33 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 34 | 35 | // cols and rows don't have to be exact to still get accurate transfer numbers 36 | #define LCD_COLS 16 37 | #define LCD_ROWS 2 38 | 39 | // declare Arduino pins used for LCD functions 40 | // and the lcd object 41 | 42 | //const int rs=12, en=11, db4=5, db5=4, db6=3, db7=2; // pins used by IDE LiquidCrystal examples 43 | const int rs=8, en=9, db4=4, db5=5, db6=6, db7=7; // lcd keypad shield pins 44 | LiquidCrystal lcd(rs, en, db4, db5, db6, db7); 45 | 46 | // tell the hd44780 sketch the lcd object has been declared 47 | #define HD44780_LCDOBJECT 48 | 49 | // include the hd44780 library sketch source code 50 | #include 51 | -------------------------------------------------------------------------------- /examples/otherLibraries/NewLiquidCrystal/LiquidCrystal_I2C/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test: NewLiquidCrystal with LiquidCrystal_I2C 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | // ugliness to allow this sketch to locate the hd44780 example sketch 23 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 24 | #include 25 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 26 | 27 | // cols and rows don't have to be exact to still get accurate transfer numbers 28 | #define LCD_COLS 16 29 | #define LCD_ROWS 2 30 | 31 | // declare the lcd object 32 | // Note: The i2c address and pin mappings must match the backpack 33 | // The pin mapping selected matches the "LiquidCrystal_I2C" library 34 | // in the IDE library manager. 35 | const uint8_t i2cAddr = 0x27; 36 | const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3; 37 | typeof(POSITIVE) blpol=POSITIVE; // backlight polarity level 38 | LiquidCrystal_I2C lcd(i2cAddr, en, rw, rs, db4, db5, db6, db7, bl, blpol); 39 | 40 | // tell the hd44780 sketch the lcd object has been declared 41 | #define HD44780_LCDOBJECT 42 | 43 | // include the hd44780 library LCDiSpeed sketch source code 44 | #include 45 | -------------------------------------------------------------------------------- /examples/otherLibraries/NewLiquidCrystal/LiquidCrystal_I2C/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test: NewLiquidCrystal with LiquidCrystal_I2C 3 | // ---------------------------------------------------------------------------- 4 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 5 | // Note: 6 | // This is not a normal sketch and should not be used as model or example 7 | // of hd44780 library sketches. 8 | // This sketch is simple wrapper that declares the needed lcd object for the 9 | // hd44780 library sketch. 10 | // It is provided as a convenient way to run a pre-configured sketch for 11 | // the i/o class. 12 | // The source code for this sketch lives in hd44780 examples: 13 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 14 | // From IDE: 15 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 16 | // 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | // ugliness to allow this sketch to locate the hd44780 example sketch 23 | // note: hd44780.h is not needed, it is only included to get its directory on the include path 24 | #include 25 | #undef hd44780_h // undefine this so the example sketch does not think hd44780 is being used. 26 | 27 | #if ARDUINO < 157 28 | #error "This sketch Requires Arduino 1.5.7 or higher" 29 | #endif 30 | 31 | // NOTE: uses API that only works on IDE 1.5.7 and up 32 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 33 | 34 | // cols and rows don't have to be exact to still get accurate transfer numbers 35 | #define LCD_COLS 16 36 | #define LCD_ROWS 2 37 | 38 | // declare the lcd object 39 | // Note: The i2c address and pin mappings must match the backpack 40 | // The pin mapping selected matches the "LiquidCrystal_I2C" library 41 | // in the IDE library manager. 42 | const uint8_t i2cAddr = 0x27; 43 | const int rs=0, rw=1, en=2, db4=4, db5=5, db6=6, db7=7, bl=3; 44 | typeof(POSITIVE) blpol=POSITIVE; // backlight polarity level 45 | LiquidCrystal_I2C lcd(i2cAddr, en, rw, rs, db4, db5, db6, db7, bl, blpol); 46 | 47 | // tell the hd44780 sketch the lcd object has been declared 48 | #define HD44780_LCDOBJECT 49 | 50 | // include the hd44780 library LCDiSpeed sketch source code 51 | #include 52 | -------------------------------------------------------------------------------- /examples/otherLibraries/NewLiquidCrystal/README.md: -------------------------------------------------------------------------------- 1 | NewLiquidCrystal hd44780 examples 2 | ================================= 3 | 4 | fm's NewLiquidCrystal library must be installed in order to use these sketches.
5 | The NewliquidCrystal library contains multiple i/o classes. 6 | 7 | 8 | #### The examples are broken up into various sub directories for each i/o class 9 | 10 | * `LiquidCrystal`
11 | Contains example sketches that are for LCDs that are wired up directly to Arduino pins. 12 | 13 | * `LiquidCrystal_I2C`
14 | Contains example sketches that are for LCDs connected to a backpack using the i2c PCF8574 i/o expander chip to control the LCD. 15 | -------------------------------------------------------------------------------- /examples/otherLibraries/README.md: -------------------------------------------------------------------------------- 1 | OtherLibraries 2 | ============== 3 | 4 | This directory contains subdirectories for other (non hd44780) libraries that contain wrapper sketches for various hd44780examples sketches. 5 | 6 | The hd44780examples directory under each subdirectory contains 7 | library and i/o class specific wrapper sketches for various sketches under 8 | examples/hd44780examples. 9 | This is intended to allow easy benchmarking of the other libraries for comparison purposes. 10 | -------------------------------------------------------------------------------- /examples/otherLibraries/SoftwareWire/README.md: -------------------------------------------------------------------------------- 1 | SoftwareWire hd44780 examples 2 | ================================== 3 | 4 | These examples require that the SoftwareWire library be installed. 5 | 6 | The SoftwareWire library can be installed using the IDE library manager. 7 | SoftwareWire provides a Wire compatable library that allows the user to 8 | configure pins for the SDA and SCL signals. 9 | While it offers additional flexibility, it will not be as fast as using the 10 | dedicated i2c h/w inside the microcontroller. 11 | 12 | These examples use the hd44780 library hd44780_I2Cexp i/o class using 13 | SoftwareWire instead of the Wire library. 14 | 15 | 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. 16 | 17 | WARNING: 18 | The SoftWareWire developers made a major change to the library June 2018 19 | which is in the subsequent 1.5.1 release that causes it be unusable by 20 | the hd44780 library. 21 | Until this change is backed out, you will not be able to use 22 | SoftWareWire beyond version 1.5.0 with the hd44780 library. 23 | -------------------------------------------------------------------------------- /examples/otherLibraries/SoftwareWire/hd44780examples/LCDiSpeed/LCDiSpeed.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for hd44780 hd44780_I2Cexp i/o class 3 | // using SoftwareWire instead of Wire 4 | // ---------------------------------------------------------------------------- 5 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 6 | // Note: 7 | // This is not a normal sketch and should not be used as model or example 8 | // of hd44780 library sketches. 9 | // This sketch is simple wrapper that declares the needed lcd object for the 10 | // hd44780 library sketch. 11 | // It is provided as a convenient way to run a pre-configured sketch for 12 | // the i/o class. 13 | // The source code for this sketch lives in hd44780 examples: 14 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 15 | // From IDE: 16 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 17 | // 18 | 19 | #include 20 | // Check for "new" SoftwareWire that breaks things 21 | #if defined(TwoWire_h) 22 | #error incompatible version of SoftwareWire library (use version 1.5.0) 23 | #endif 24 | 25 | const int sda=SDA, scl=SCL; // use same pins as h/w i2c 26 | SoftwareWire Wire(sda,scl); 27 | 28 | #include 29 | #include // include i/o class header 30 | 31 | // declare the lcd object 32 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 33 | 34 | // tell the hd44780 sketch the lcd object has been declared 35 | #define HD44780_LCDOBJECT 36 | 37 | // include the hd44780 library LCDiSpeed sketch source code 38 | #include 39 | -------------------------------------------------------------------------------- /examples/otherLibraries/SoftwareWire/hd44780examples/LCDiSpeed400/LCDiSpeed400.ino: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // LCDiSpeed - LCD Interface Speed test for hd44780 hd44780_I2Cexp i/o class 3 | // using SoftwareWire instead of Wire 4 | // ---------------------------------------------------------------------------- 5 | // This sketch is a wrapper sketch for the hd44780 library example LCDiSpeed. 6 | // Note: 7 | // This is not a normal sketch and should not be used as model or example 8 | // of hd44780 library sketches. 9 | // This sketch is simple wrapper that declares the needed lcd object for the 10 | // hd44780 library sketch. 11 | // It is provided as a convenient way to run a pre-configured sketch for 12 | // the i/o class. 13 | // The source code for this sketch lives in hd44780 examples: 14 | // hd44780/examples/hd44780examples/LCDiSpeed/LCDiSpeed.ino 15 | // From IDE: 16 | // [File]->Examples-> hd44780/hd44780examples/LCDiSpeed 17 | // 18 | 19 | #include 20 | // Check for "new" SoftwareWire that breaks things 21 | #if defined(TwoWire_h) 22 | #error incompatible version of SoftwareWire library (use version 1.5.0) 23 | #endif 24 | 25 | const int sda=SDA, scl=SCL; // use same pins as h/w i2c 26 | SoftwareWire Wire(sda,scl); 27 | 28 | #include 29 | #include // include i/o class header 30 | 31 | #if ARDUINO < 157 32 | #error "This sketch Requires Arduino 1.5.7 or higher" 33 | #endif 34 | 35 | // NOTE: uses API that only works on IDE 1.5.7 and up 36 | #define WIRECLOCK 400000L // tell hd44780 example to use this i2c clock rate 37 | 38 | // declare the lcd object 39 | hd44780_I2Cexp lcd; // auto locate and autoconfig interface pins 40 | 41 | // tell the hd44780 sketch the lcd object has been declared 42 | #define HD44780_LCDOBJECT 43 | 44 | // include the hd44780 library LCDiSpeed sketch source code 45 | #include 46 | -------------------------------------------------------------------------------- /extras/buildtools/mkChangeLog: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # vi:ts=4 3 | # 4 | # mkChangLog - produce a ChangeLog from git history on stdout 5 | # 6 | # SYNOPSIS 7 | # mkChangeLog [OPTION] 8 | # 9 | # DESCRIPTION 10 | # Extract commit comments and label each tag with a date 11 | # from most recent to oldest. 12 | # Default output is suitable for including in markdown files 13 | # 14 | # -c curRev - use CurRev as tag name if current rev (latest commit) has no tag 15 | # 16 | # -s stopRev - will stop the log with the specified tag 17 | # changelog will not show commit messages earlier than the stopRev tag 18 | # To indicate stopping at very first tag, use - 19 | # 20 | # -H heading - use heading instead of "CHANGELOG" for heading1 of log 21 | # 22 | # -h heading - use heading instead of "------------" for heading2 of log 23 | # 24 | # AUTHOR 25 | # Bill Perry bperrybap@opensource.billsworld.billandterrie.com 26 | # 2016-08-08 27 | # 28 | # NOTES: 29 | # The reason for the curRev option is that when creating a changelog file that 30 | # needs to be part of a tagged revision, there is a chicken & egg problem of 31 | # how do you create the changelog for that revision and also set the tag for 32 | # the revision that includes the updated changelog file? 33 | # If you set the tag to get the changelog output to include the new tag, then 34 | # when you commit the changelog file created from the log output, there is an 35 | # additional commit that affects the log and the log file for the commit is 36 | # *after* the tag instead of being at the tag. 37 | # The answer to this dilema: "CHEAT" a bit. 38 | # So the curRev option will fake the tagname on the most recent commits since 39 | # the previous tag to be the name "curRev" even though the tag has not yet been 40 | # set. There is still one limitation the commit log message for updating the 41 | # changelog file will not be shown for the changes associated with the new tag. 42 | # There is no way to work around this. 43 | # However, the log message entry will show when the next tag is created, so it 44 | # is only the most recent tag that will be missing the commit message for the 45 | # changelog file update. 46 | # 47 | # This allows a process of: 48 | # 49 | # - generate the ChangeLog with curRev as tag about to be created 50 | # - commit ChangeLog 51 | # - tag with the tag used as curRev 52 | # 53 | # This will create a single commit as well as the desired tag pointing 54 | # to the commit that contains the log for new tag. 55 | # 56 | # 57 | 58 | pname=`basename $0` 59 | 60 | HEADING1="CHANGELOG" 61 | HEADING2="----------------------" 62 | 63 | function USAGE { 64 | printf "usage:\n" 65 | printf "$pname [option]\n" 66 | printf "\t-c curRev\n\t\tuse CurRev as tagname if current rev has no tag\n" 67 | printf "\t-s stopRev\n\t\tno log output prior to stopRev tag\n" 68 | printf "\t-H heading\n\t\tuse heading instead of \"$HEADING1\" for heading1 of log\n" 69 | printf "\t-h heading\n\t\tuse heading instead of \"$HEADING2\" for heading2 of log\n" 70 | } 71 | 72 | # check for arguments 73 | while getopts ":s:c:H:h:" opt; do 74 | case $opt in 75 | c) 76 | curRev=$OPTARG 77 | ;; 78 | s) 79 | stopRev=$OPTARG 80 | ;; 81 | H) 82 | HEADING1=$OPTARG 83 | ;; 84 | h) 85 | HEADING2=$OPTARG 86 | ;; 87 | \?) 88 | echo "$pname: invalid option: -$OPTARG" >&2 89 | USAGE 90 | exit 1 91 | ;; 92 | :) 93 | echo "Option -$OPTARG requires an argument." >&2 94 | USAGE 95 | exit 1 96 | ;; 97 | esac 98 | done 99 | 100 | 101 | # if stopRev is "-" then use first tag in repo 102 | if [ "$stopRev" = "-" ] 103 | then 104 | stopRev=$(git tag -l | head -1) 105 | fi 106 | 107 | #now generate the change log 108 | 109 | # if headings are empty, don't output them 110 | if [ "$HEADING1" != "" ] 111 | then 112 | echo "$HEADING1" 113 | fi 114 | if [ "$HEADING2" != "" ] 115 | then 116 | echo "$HEADING2" 117 | fi 118 | 119 | git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags |tac |grep -v '^$' | while read TAG ; do 120 | echo 121 | if [ $NEXT ];then 122 | rev=$NEXT 123 | else 124 | if [ "$curRev" != "" ] 125 | then 126 | rev=$curRev 127 | else 128 | rev=`git describe --dirty` 129 | fi 130 | fi 131 | if [ "$rev" != "$TAG" ] 132 | then 133 | echo [$rev] - `git log -1 --format=%ad --date=short $NEXT` 134 | if [ "$rev" = "$stopRev" ] 135 | then 136 | # note: the exit below exits the loop command not the script 137 | # the exit value will be the status code of the loop 138 | exit 9 139 | fi 140 | GIT_PAGER=cat git log --no-merges --format=" * %s" $TAG..$NEXT 141 | fi 142 | NEXT=$TAG 143 | done 144 | 145 | # if loop exited because it stopped early from a stopRev, status will be non zero 146 | # so exit script 147 | if [ $? -ne 0 ] 148 | then 149 | exit 0 150 | fi 151 | FIRST=$(git tag -l | head -1) 152 | echo 153 | echo [$FIRST] - `git log -1 --format=%ad --date=short $FIRST` 154 | if [ "$FIRST" = "$stopRev" ] 155 | then 156 | exit 0 157 | fi 158 | # if this GIT_PAGER below is commented out then the logs for the first tag are not emitted 159 | GIT_PAGER=cat git log --no-merges --format=" * %s" $FIRST 160 | -------------------------------------------------------------------------------- /extras/buildtools/mkreleasePostPatcher: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vi:ts=4 3 | #============================================================================= 4 | # This version of the script patches files for the hd44780 arduino library 5 | #============================================================================= 6 | # 7 | # mkreleasePostPatcher - do things after patcher has run 8 | # 9 | # SYNOPSIS 10 | # mkreleasePostPatcher 11 | # 12 | # DESCRIPTION 13 | # mkreleasePostPatcher is called by the mkRelease script that controls the 14 | # process for making a new release. 15 | # mkrelease will call it after mkreleasePatch has been run 16 | # It massages patched files like the README.md markdown file to html for use 17 | # in the documentation 18 | # 19 | # This script depends on the tool 'grip' which can be found here: 20 | # https://github.com/joeyespo/grip 21 | # 22 | # AUTHOR 23 | # Created by Bill Perry 2018-02-03 24 | # bperrybap@opensource.billsworld.billandterrie.com 25 | # 26 | #============================================================================= 27 | 28 | # location of root repository directory relative to directory where script lives 29 | repodir=../.. 30 | 31 | # location of where Documenation files are stored 32 | HTMLdocs=./examples/Documentation/docs 33 | 34 | #get name & location of this script 35 | progname=`basename $0` 36 | progwd=`dirname $0` 37 | 38 | #make sure script running in root repo directory where script lives 39 | # note: this is done in two steps since progwd might or might not be a full path 40 | cd $progwd 41 | #make sure progwd is full path 42 | progwd=`pwd` 43 | cd $repodir 44 | 45 | ####################################################################### 46 | # Create the README.html file from the README.md file 47 | ####################################################################### 48 | 49 | # this script is running in the root of repository 50 | # so all files being used/updated need to be relative to that location 51 | 52 | echo Creating README html file in docs area 53 | grip --quiet --title=README README.md --export $HTMLdocs/README.html 54 | 55 | exit 0 56 | -------------------------------------------------------------------------------- /extras/buildtools/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains scripts to aid in the building of a library release. 2 | Their main purpose is the update revision information in the files and to 3 | automatically create a changelog. 4 | 5 | The scripts are bash shell scripts. 6 | If you are using a Wimpy/Crappy OS like Windows you are SOL. 7 | 8 | To create a new release: 9 | - commit all file changes 10 | - run mkrelease script (optionally pass in version string like 1.0.5 etc...) 11 | 12 | Note: use "grip" tool to view README file as html 13 | 14 | mkrelease can be run from the commandline or from a gui file manager 15 | 16 | The mkrelease script will: 17 | - check to see if all files have been commited 18 | - prompt for a version string if not passed in 19 | - massasge version string to make it SemVer compliant 20 | - call mkreleasePrePatcher (if it exists) 21 | - this potentially does things that need to be done before the patcher runs 22 | currently this does nothing. 23 | - call mkreleasePatcher: 24 | - patches all the necessary files to update version information. 25 | - calls mkChangeLog to insert an auto generated changelog from git log info into Readme.md 26 | - call mkreleasePostPatcher (if it exists) 27 | - this potentially does things that need to be after the patcher runs 28 | currently this converts the patched README.md to html stored in the "docs" directory 29 | 30 | - optionally commit all modified files & tag repo with specified tag 31 | -------------------------------------------------------------------------------- /hd44780ioClass/README.md: -------------------------------------------------------------------------------- 1 | hd44780ioclass 2 | ============== 3 | 4 | This directory contains the source code for each of the i/o classes that are 5 | included in the hd44780 library package. 6 | Each i/o class has its own .h file. 7 | 8 | #### The library currenly comes with the following i/o subclasses: 9 | 10 | * `hd44780_HC1627_I2C` control LCD with native i2c interface (Tsingtek Display HC1627) 11 | 12 | * `hd44780_I2Cexp` control LCD using i2c i/o exapander backpack (PCF8574 or MCP23008) 13 | 14 | * `hd44780_I2Clcd` control LCD with native i2c interface (PCF2116, PCF2119x, etc...) 15 | 16 | * `hd44780_NTCU165ECPB` control Noritake CU165ECBP-T2J LCD display over SPI 17 | 18 | * `hd44780_NTCU20025ECPB_pinIO` control Noritake CU20025ECPB using direct Arduino pin connections 19 | 20 | * `hd44780_NTCUUserial` control Noritake CU-U Series VFD display in serial mode 21 | 22 | * `hd44780_pinIO` control LCD using direct Arduino Pin connections 23 | 24 | See each header file for further details. 25 | 26 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Syntax Coloring Map For hd44780 3 | # note: 4 | # the alignment in the file looks like crap 5 | # because the IDE doesn't parse white space 6 | # correctly so a single tab must be used on 7 | # keyword lines 8 | # old IDEs only support a single tab 9 | # new IDES support mutiple tabs 10 | # as of 1.6.9 no IDE supports using space 11 | # or multiple spaces. 12 | # This is mess because of the obstinance of 13 | # the Arduino team developers refusing to 14 | # change a single line of code in the IDE 15 | # to use whitespace which is space(s)/tab(s) 16 | # rather than explicitly requiring a single 17 | # tab as a seperator 18 | ########################################### 19 | 20 | ########################################### 21 | # Datatypes (KEYWORD1) 22 | ########################################### 23 | 24 | hd44780 KEYWORD1 25 | hd44780_I2Cexp KEYWORD1 26 | hd44780_I2Clcd KEYWORD1 27 | hd44780_NTCU165ECPB KEYWORD1 28 | hd44780_NTCUUserial KEYWORD1 29 | hd44780_pinIO KEYWORD1 30 | iotype KEYWORD1 31 | 32 | ########################################### 33 | # Methods and Functions (KEYWORD2) 34 | ########################################### 35 | # LiquidCrystal API 36 | begin KEYWORD2 37 | clear KEYWORD2 38 | home KEYWORD2 39 | setCursor KEYWORD2 40 | write KEYWORD2 41 | print KEYWORD2 42 | println KEYWORD2 43 | cursor KEYWORD2 44 | noCursor KEYWORD2 45 | blink KEYWORD2 46 | noBlink KEYWORD2 47 | display KEYWORD2 48 | noDisplay KEYWORD2 49 | scrollDisplayLeft KEYWORD2 50 | scrollDisplayRight KEYWORD2 51 | autoscroll KEYWORD2 52 | noAutoscroll KEYWORD2 53 | leftToRight KEYWORD2 54 | rightToLeft KEYWORD2 55 | createChar KEYWORD2 56 | moveCursorLeft KEYWORD2 57 | moveCursorRight KEYWORD2 58 | setRowOffsets KEYWORD2 59 | command KEYWORD2 60 | 61 | # mandatory LCD 1.0 API functions 62 | init KEYWORD2 63 | 64 | # optional LCD 1.0 API functions 65 | setBacklight KEYWORD2 66 | setContrast KEYWORD2 67 | on KEYWORD2 68 | off KEYWORD2 69 | status KEYWORD2 70 | 71 | # deprecacted LCD 1.0 API functions 72 | blink_on KEYWORD2 73 | blink_off KEYWORD2 74 | cursor_on KEYWORD2 75 | cursor_off KEYWORD2 76 | load_custom_char KEYWORD2 77 | setDelay KEYWORD2 78 | 79 | # hd44780 extensions 80 | _write KEYWORD2 81 | backlight KEYWORD2 82 | noBacklight KEYWORD2 83 | lineWrap KEYWORD2 84 | noLineWrap KEYWORD2 85 | read KEYWORD2 86 | setExecTimes KEYWORD2 87 | blinkLED KEYWORD2 88 | fatalError KEYWORD2 89 | 90 | # hd44780 internal i/o class virtual functions 91 | ioinit KEYWORD2 92 | ioread KEYWORD2 93 | iowrite KEYWORD2 94 | iosetBacklight KEYWORD2 95 | iosetContrast KEYWORD2 96 | 97 | ########################################### 98 | # Constants (LITERAL1) 99 | ########################################### 100 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=hd44780 2 | version=1.3.2 3 | author=Bill Perry 4 | maintainer=Bill Perry 5 | sentence=Extensible hd44780 LCD library. 6 | paragraph=hd44780 is an extensible LCD library for hd44780 based LCD displays. The API functionality provided by the hd44780 library class, when combined with an hd44780 library i/o subclass, is compatible with the API functionality of the Arduino LiquidCrystal library as well as most of the LCD API 1.0 Specification. The hd44780 API also provides some addtional extensions, including return status for API functions, ability to read from the LCD, and ability to configure the LCD command execution timing. hd44780 currently includes i/o subclasses for Arduino direct pin control, i2c expander backpacks, and LCDs with native i2c interface. keywords: hd44780 lcd i2c display hd44780_I2Cexp hd44780_pinIO hd44780_I2Clcd LiquidCrystal Bill Perry bperrybap duinowitchery HC1627 Noritake CU165ECBP-T2J NTCU20025ECPB 7 | category=Display 8 | url=https://github.com/duinoWitchery/hd44780 9 | architectures=* 10 | includes=hd44780.h 11 | --------------------------------------------------------------------------------