问题描述
我最近下载了Intel XDK IOT版本,并使用了LED引脚13 Blink示例.然后,我将程序上载到Edison,但出现了一些错误.其中之一是它找不到MRAA模块.随附的示例代码为:main.js:
I recently downloaded the Intel XDK IOT version and used the LED pin 13 Blink sample.I then uploaded the program onto the Edison, but it came up with a few errors; One of them being that it could not find the MRAA module. The sample code that came with it was:main.js:
var mraa = new require("mraa"); //require mraa
console.log('MRAA Version: ' + mraa.getVersion()); //write the mraa version to the Intel XDK console
var myOnboardLed = new mraa.Gpio(13); //LED hooked up to digital pin 13 (or built in pin on Galileo Gen1 & Gen2)
myOnboardLed.dir(mraa.DIR_OUT); //set the gpio direction to output
var ledState = true; //Boolean to hold the state of Led
periodicActivity(); //call the periodicActivity function
function periodicActivity()
{
myOnboardLed.write(ledState?1:0); //if ledState is true then write a '1' (high) otherwise write a '0' (low)
ledState = !ledState; //invert the ledState
setTimeout(periodicActivity,1000); //call the indicated function after 1 second (1000 milliseconds)
}
package.JSON:
package.JSON:
{
"name": "Onboard LED Blink App",
"description": "",
"version": "0.0.0",
"main": "main.js",
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
}
}
推荐答案
echo"src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic >/etc/opkg/mraa-upm.confopkg更新opkg安装libmraa0
echo "src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/mraa-upm.confopkg updateopkg install libmraa0
以上答案有错别字它应该是"mraa"而不是"maa"和opkg不好
the above answer has typosit should be "mraa" not "maa"and opkg not okpg
这篇关于英特尔Edison MRAA模块不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!