我想为伽利略使用node.js mraa库。 我需要设置一个中断。 我通过实现这一点:Node.js函数不能用于isr galileo板
var param=1;
var myLed = new mraa.Gpio(2);
myLed.dir(mraa.DIR_IN); //set the gpio direction to input
myLed.isr(mraa.EDGE_BOTH,function f(x){},param);
我得到这个错误
in method 'Gpio_isr', argument 3 of type 'void (*)(void *)'
这个函数的文档指出
mraa_result_t isr ( Edge mode,
void(*)(void *) fptr,
void * args
)
Sets a callback to be called when pin value changes
Parameters
mode The edge mode to set
fptr Function pointer to function to be called when interupt is triggered
args Arguments passed to the interrupt handler (fptr)
Returns
Result of operation
我不知道如何设置的功能PARAMS ...
我不熟悉的功能mraa库,但是你有没有考虑使用Johnny-Five和Galileo-IO来读取你的传感器? – 2014-11-05 14:35:27