4 Replies Latest reply on Feb 18, 2015 6:49 PM by 74hc595

    mraa ISR in Javascript

    74hc595

      I'm trying to run the following code. When it runs, I get the error pasted below. Due to the lack of JS documentation, I'm only able to work from the Python examples, however running similar code seems to work in Python. Has anybody gotten isr() to work in Javascript?

       

       

      var m = require('mraa');

      var led = new m.Gpio(8);

      led.dir(m.DIR_OUT);

      var button = new m.Gpio(12);

      button.dir(m.DIR_IN);

       

      button.isr(m.EDGE_BOTH, function (f) {

          led.write(!led.read());

      }, null);

       

       

      ERROR: button.isr(m.EDGE_BOTH, function (f) {                                                                                                                                                                                                                           

             ^                                                                                                                                                                                                                                                                  

      ERROR: Error: in method 'Gpio_isr', argument 3 of type 'void (*)(void *)'                                                                                                                                                                                                 

          at Object.<anonymous> (/node_app_slot/main.js:31:8)                                                                                                                                                                                                                   

          at Module._compile (module.js:456:26)                                                                                                                                                                                                                                 

          at Object.Module._extensions..js (module.js:474:10)                                                                                                                                                                                                                   

          at Module.load (module.js:356:32)                                                                                                                                                                                                                                     

          at Function.Module._load (module.js:312:12)                                                                                                                                                                                                                           

          at Function.Module.runMain (module.js:497:10)                                                                                                                                                                                                                         

          at startup (node.js:119:16)                                                                                                                                                                                                                                           

          at node.js:906:3