LCD not working in node.js + Arduino project

僤鯓⒐⒋嵵緔 提交于 2019-12-12 05:25:26

问题


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.

来源:https://stackoverflow.com/questions/43965869/lcd-not-working-in-node-js-arduino-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!