20x4 LCD Display with I2C serial interface

Posted on
  • Have one of these, works fine. First time (well once I understood which pins support I2c - another thread on that). But I want to know whether I need to tell Espruino that it's 20x4, and if so how?

    This code

    I2C1.setup({scl:B6, sda:B7});
    var lcd = require("HD44780").connectI2C(I2C1);
    lcd.clear();
    lcd.print("Testing 123 123 123 123 123 123 123");
    
    

    Prints "Testing 123 123 123" on the top row of the display, then there is a blank row, and then I get the final "123 123 123 123" on the third row. As expected ?

    Is the a way to specify which row/column I want a piece of text to start ?

    Pat

  • Did you try lcd.setCursor(1,0) to get to the second line?
    http://www.espruino.com/HD44780
    At a low level, it seems this is based on the LCD controller(s) used in the display. See here: http://forum.arduino.cc/index.php/topic,123864.0.html (Reply #5).

  • Yes, it's just the way it works. I think setCursor takes account of this - you just have to be careful not to go past the end of the line :)

  • Thanks all. Sorry again, I failed to scroll down far enough at http://espruino.com/HD44780

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

20x4 LCD Display with I2C serial interface

Posted by Avatar for Pat @Pat

Actions