在节点J和Arduino上使用带有Johnny Five的LCD库

时间:2017-05-02 00:11:28

标签: node.js arduino lcd johnny-five

我正试图让我的液晶显示屏关掉背光灯再打开它。

打开它的命令:lcd.noBacklight();工作正常,但我不知道如何再打开它。

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

board.on("ready", function() {

  var lcd = new five.LCD({
    controller: "PCF8574T"
  });

  lcd.cursor(0, 0).print("1 Hello Teste");
  lcd.cursor(1, 0).print("2 Hello Teste");
  lcd.cursor(2, 0).print("3 Hello Teste");
  lcd.cursor(3, 0).print("4 Hello Teste");

  lcd.noBacklight();

  setTimeout(() => {
    lcd.yesBacklight(); //Here I don't know what to do
  }, 1500);

  setInterval(() => {
    lcd.noBacklight();
  }, 1500);


});

我怎么能再打开它?

1 个答案:

答案 0 :(得分:0)

好的,解决了只是将lcd.backlight();放在小写的情况下。

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

board.on("ready", function() {
  var i = 0;
  var lcd = new five.LCD({
    controller: "PCF8574T"
  });

  lcd.cursor(0, 0).print("1 Hello Teste");
  lcd.cursor(1, 0).print("2 Hello Teste");
  lcd.cursor(2, 0).print("3 Hello Teste");
  lcd.cursor(3, 0).print("4 Hello Teste");

  setInterval(() => {
    lcd.clear();
    lcd.noBacklight();
    lcd.cursor(0, 0).print(i + " Hello Teste");
    i++;
    lcd.backlight();
  }, 1500);


});