我最近下载了英特尔XDK IOT版本,并使用LED引脚13闪烁示例。 然后我把程序上传到爱迪生上,但是它出现了一些错误;其中之一是它无法找到MRAA模块。也带来了它的示例代码为: main.js:英特尔爱迪生MRAA模块不工作
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:
{
"name": "Onboard LED Blink App",
"description": "",
"version": "0.0.0",
"main": "main.js",
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
}
}
这个工作完全谢谢 – 2014-10-10 03:27:40