码迷,mamicode.com
首页 > 其他好文 > 详细

intel edison with grove lcd

时间:2014-10-31 08:50:01      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:intel edison   nodejs   lcd   

通过intel xdk,如下的程序可以打印Hello world到grove lcd上


var mraa = require ('mraa');
var LCD  = require ('jsupm_i2clcd');
console.log('Current version of MRAA is', mraa.getVersion());

var light = new mraa.Aio(0);
var lightValue;
var lcdMessage=" ";
var myLCD = new LCD.Jhd1313m1(6, 0x3E, 0x62);

loop();

function loop(){
    lightValue  = light.read();
    lightValue = Math.round( lightValue*.1);
    lcdMessage = "Light is @ "+lightValue+"%";
    myLCD.setCursor(0,1);
    console.log(lcdMessage); 
    myLCD.write(lcdMessage);
    setTimeout(loop,1000);
}


如果碰到如下错误

ERROR:Error: Cannot find module ‘jsupm_i2clcd‘
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/node_app_slot/main.js:5:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.run

可以通过下面的方法解决更新libmraa 和 upm

</pre><pre name="code" class="javascript">cat > /etc/opkg/mraa-upm.conf <<EOF
src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic
EOF
opkg upgrade
opkg update


然后通过

opkg info upm | head -n2


查看是否得到类似于如下的信息

Package: upm
Version: 0.1.8.32

如果没有得到表明没有安装upm,可以通过如下命令安装

opkg install upm


intel edison with grove lcd

标签:intel edison   nodejs   lcd   

原文地址:http://blog.csdn.net/alexwang1983/article/details/40648657

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!