I am running practically the example code:
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
let lcd = new five.LCD({ pins: [2, 3, 4, 5, 6, 7]});
lcd.useChar("heart")
lcd.print("test :heart: test");
})
And nothing is printed to the screen. I have tried reinstalling johnny-five, but this does not fix the issue. Regular characters print just fine to the LCD, it is only custom ones that fail. I tested my LCD out in the Arduino IDE with a custom character and it drew it just fine, but for some reason no character will work in johnny-five. Is this a known issue or have I completely done something wrong?
Edit: Actually, if I use useChar, it will not print ANYTHING to the LCD afterwards.
I've narrowed it down to the createChar function, specifically the
this.command(this.REGISTER.SETCGRAMADDR | (address << 3));
line in the lcd.js file.
If I remove this line, it doesn't print the character, but I can write other characters to the screen, whereas with that line I cannot write anything to the screen until I reset and remove the useChar() function.
Again, custom characters works fine for me in the regular arduino IDE, but something goes amiss for me in johnny-five. Does anyone have any idea as to why this might be happening? Any help is appreciated!
Sorry for the delay in responding here. I'm not sure why this would stop working鈥攏o code has changed in LCD.
@fivdi is something of an expert with LCD, perhaps he can help us figure this out.
After invoking useChar the cursor needs to be positioned by invoking cursor. The following should work:
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
let lcd = new five.LCD({ pins: [2, 3, 4, 5, 6, 7]});
lcd.useChar("heart")
lcd.cursor(0, 0); // <=== Add this to get it to work
lcd.print("test :heart: test");
})
Further details: Invoking useChar sets the address counter on the LCD to the CGRAM address. From this point onwards all data writes are to CGRAM. Invoking cursor sets the address counter on the LCD to the DDRAM address. From this point onwards all data write are to DDRAM.
To display characters on the LCD the characters need to be written to the DDRAM.
I cannot believe the problem was that simple. Thank you so much, this seems to work!
Thanks @fivdi !
Most helpful comment
I cannot believe the problem was that simple. Thank you so much, this seems to work!