If you have one of the LCDs with an I2C backpack, just use:
I2C1.setup({scl:B6, sda:B7});
var lcd = require("HD44780").connectI2C(I2C1);
lcd.print("Hello World!");
You can specify device address following way:
require("HD44780").connectI2C(I2C1, 0x3F);
Otherwise try:
var lcd = require("HD44780").connect(A4,A5,A0,A1,A2,A3);
lcd.print("Hello World!");
...
.....
////////////////////////////
The implementation is:
exports.connectI2C = function(/*=I2C*/i2c, _addr) {
return new HD44780(function(x, c) {
var a = (x&0xF0) |8| ((c===undefined)?1:0);
var b = ((x<<4)&0xF0) |8| ((c===undefined)?1:0);
i2c.writeTo(_addr || 0x27, [a,a,a|4,a|4,a,a,b,b,b|4,b|4,b,b]);
});
};
So there is a plain .connect(... and a .connectI2C(....
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon, did you just change the module per this occasion? ...because when I look at it I see:
...straight out of the 'Header' of modules/HD44780.js:
////////////////////////////
.....
...
If you have one of the LCDs with an I2C backpack, just use:
You can specify device address following way:
Otherwise try:
...
.....
////////////////////////////
The implementation is:
So there is a plain
.connect(...
and a.connectI2C(...
.