kir*_*hah 7 arduino node.js intel-xdk iot intel-edison
我最近下载了Intel XDK IOT版本并使用了LED引脚13 Blink示例.然后我把程序上传到爱迪生,但它出现了一些错误; 其中一个是它无法找到MRAA模块.随附的示例代码是: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)
}
Run Code Online (Sandbox Code Playgroud)
的package.json:
{
"name": "Onboard LED Blink App",
"description": "",
"version": "0.0.0",
"main": "main.js",
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
}
}
Run Code Online (Sandbox Code Playgroud)
小智 5
根据您拥有的Edison固件版本,可能无法正确安装Node.js的mraa模块.要安装最新版本的mraa,请将Edison连接到互联网(通过wifi)并通过ssh或串行终端运行以下命令
echo "src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/mraa-upm.conf
okpg update
opkg upgrade
Run Code Online (Sandbox Code Playgroud)
小智 3
echo "src mraa-upm http://iotdk.intel.com/repos/1.1/intelgactic " > /etc/opkg/mraa-upm.conf opkg 更新 opkg 安装 libmraa0
上面的答案有拼写错误,应该是“mraa”而不是“maa”,opkg 不是 okpg
| 归档时间: |
|
| 查看次数: |
4113 次 |
| 最近记录: |