11 Replies Latest reply on Apr 20, 2015 10:08 PM by WesleyMilan

    I2C question Javascript mraa (Intel Edison)


      Hi all I have a question related with mraa I2C. Now I'm working with compass module and I need write and read information in the register. The first is get the version software. My question is how can I read data of specific register using mraa?. To start the communication the compass use this address 0x60 and to get the version softwares use this 0x11 and this is my code.


      function getVersion() {
        i2c.write(char('0'));              // Sends the register we wish to start reading from  
        i2c.writeReg(char('0x60'), char('1')); 
          var d = i2c.read();
          console.log("Version: " + parseInt(d));
        setTimeout(function (e) { getVersion(); }, 100);
      function char(x) { return parseInt(x, 16); }