Sunday, 14 May 2017

LCD not working in node.js + Arduino project

I am following this tutorial, but I am doing a very basic version where I just want to print something out.

All the pins and hardware specification are followed as per that tutorial.

Below is my app.js code:

var five = require('johnny-five');
var board = new five.Board();
var lcd;

board.on('ready', function() {
    lcd = new five.LCD({
        // LCD pin name  RS  EN  DB4 DB5 DB6 DB7
        // Arduino pin # 12, 11, 5, 4, 3, 2
        pins: [12, 11, 5, 4, 3, 2],
        rows: 2,
        cols: 16
    });

    lcd.clear().print("Hello NJ");

    this.repl.inject({
        lcd: lcd
    });
});

The problem is, when I connect my arduino to my laptop the lcd screen lits up, however when I run the code it does not show anything on the screen. I also followed this tutorial and the result is same.

Even if I remove the print command and do something like

lcd.noBacklight();

it does not work.

Even if I write the lcd.print("hello world") command in the console, it does not get printed on the lcd (however it does not show me any error on the console).

I have uploaded the Standard Firmata using my Arduino IDE. The johnny-five module works cause I tried their led examples and it was working.

Is my lcd device messed up or is it my code or is it my hardware connections?

I am confused.



via codeinprogress

No comments:

Post a Comment