You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • To get the value from 0, you need to subtract a 'base' value.

    For instance you could do:

    Puck.accelOn();
    var accZero = Puck.accel().acc; // get the base value when we start up
    Puck.on('accel', function(data) {
      console.log(data.acc.x - accZero.x);
    });
    

    If you want to stop the values moving so fast, you can do an average:

    Puck.accelOn();
    var accZero = Puck.accel().acc; // get the base value when we start up
    var avrX = 0;
    Puck.on('accel', function(data) {
      avrX = (avrX*0.9) + 0.1*(data.acc.x - accZero.x);
      console.log(avrX);
    });
    

    You can change values to get a slower movement but they must always add up to 1, so 0.9/0.1 or 0.8/0.2(faster) or 0.95/0.05(slower)

About

Avatar for Gordon @Gordon started