3 Replies Latest reply on Dec 30, 2015 2:12 PM by PabloM_Intel

    I can't run PWM on Intel Romeo board

    AndrikFilatov

      Hi,

       

      I'm using Intel XDK. The code is:

       

      var mraa = require("mraa"); //require mraa

      var pwm3 =  mraa.Pwm(9);

      pwm3.enable(true);

       

      pwm3.period_us(2000);

      var value = 0.0;

       

      setInterval(function () {

          if (value >= 1.0) {

              value = 0.0;

          }

         

          value = value + 0.03;

          pwm3.write(value); //Write duty cycle value.

       

          console.log(pwm3.read());//read current value that is set before.

      }, 3000);

       

      and it rise error. Mraa version 0.9.0

       

                                                                                                                                                                                                                                                                                                                               

      ERROR: /home/root/.node_app_slot/main.js:24                                                                                                                                                                                                                                                                              

      ERROR: var pwm3 =  mraa.Pwm(9);                                                                                                                                                                                                                                                                                          

                       ^                                                                                                                                                                                                                                                                                                       

      ERROR: Error: Illegal arguments for construction of _exports_Pwm                                                                                                                                                                                                                                                         

          at Object.<anonymous> (/home/root/.node_app_slot/main.js:24:18)                                                                                                                                                                                                                                                      

          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:935:3