respeaker / get_started_with_respeaker

This is the wiki of ReSpeaker Core V2, ReSpeaker Core and ReSpeaker Mic Array.
257 stars 83 forks source link

node mraa lib #247

Open wirsing opened 4 years ago

wirsing commented 4 years ago

Which version is your board?

ReSpeaker Core v2

I'm currently trying to get the LED's to work through node using the mraa node library but am running into trouble.

Here is my code:

const mraa = require('mraa'); //require mraa
let power = new mraa.Gpio(12); //setup digital read on pin 12
power.dir(mraa.DIR_OUT); //set the gpio direction to output
power.write(1);

And here is the output:

let power = new mraa.Gpio(12); //setup digital read on pin 12
            ^
Error: Illegal arguments for construction of _exports_Gpio
    at Error (native)
    at Object.<anonymous> (/home/respeaker/led_custom/index.js:9:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)

Using node 6.10.3

Any idea why the node version would throw this error? I tried running as root as well with no success.