With intel xdk, the following program can print Hello World to the 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);}
If the following error occurs:
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
Update libmraa and UPM through the following methods:
</pre><pre name="code" class="javascript">cat > /etc/opkg/mraa-upm.conf <<EOFsrc mraa-upm http://iotdk.intel.com/repos/1.1/intelgalacticEOFopkg upgradeopkg update
Then
opkg info upm | head -n2
Check whether the following information is obtained:
Package: upmVersion: 0.1.8.32
If no UPM is installed, run the following command to install it:
opkg install upm
Intel Edison with Grove LCD