2 Replies Latest reply on Dec 11, 2015 2:05 AM by Mondher_Ben_Ammar

    Get Data From ITG3200 Gyroscope using Intel Edison (Arduino board) using node js (mraa)

    Mondher_Ben_Ammar

      Hi, I 'm trying to get data from ITG3200 sensor using mraa library under node js,

      the broblem is that the ITG3200 library from UMP is not supported by the board.

       

      01// Load gyroscope module
      02var itg3200 = require('jsupm_itg3200');
      03// load this on i2c
      04var gyro = new itg3200.Itg3200(0);
      05
      06var rot;
      07var ang;
      08
      09// Note: Sensor not supported on Intel Edison with Arduino breakout
      10setInterval(function()
      11{
      12    gyro.update(); // Update the data
      13    rot = gyro.getRawValues(); // Read raw sensor data
      14    ang = gyro.getRotation(); // Read rotational speed (deg/sec)
      15    var rots = (rot.getitem(0) + " ");
      16    rots += (rot.getitem(1) + " ");
      17    rots += rot.getitem(2);
      18    var temp = round2Digits(gyro.getTemperature());
      19    var raw = round2Digits(gyro.getRawTemp());
      20    console.log("Raw: " + rots);
      21    console.log("AngX: " + round2Digits(ang.getitem(0)));
      22    console.log("AngY: " + round2Digits(ang.getitem(1)));
      23    console.log("AngZ: " + round2Digits(ang.getitem(2)));
      24    console.log("Temp: " + temp + " Raw: " + raw);
      25}, 1000);
      26
      27function round2Digits(num)
      28{
      29    return Math.round((num + 0.00001) * 100) / 100;
      30}
      31
      32// Print message when exiting
      33process.on('SIGINT', function()
      34{
      35    console.log("Exiting...");
      36    process.exit(0);
      37});

       

       

      as you can see the  Sensor is not supported on Intel Edison with Arduino breakout, so i'm asking if there is a solution to make this library supported by the intel arduino board.

      if note What should I do to get data from the sensor.

      i belive tha in the line 04 "var gyro = new itg3200.Itg3200(0);" the "0" is correspond with the I2C Bus 1 (SCL/SDA pins on the board)i tried to change it to 5 (A4/A5 in the board) and I get nothing.

      Thanks.