• Ok, well it seems there's code already to go back to the main menu when BTN2 is pressed, so all you need to do is change BTN2 to BTN3 in this code:

        Bangle.removeListener('accel', accelHandler);
      }, BTN2);

    In terms of saving the measurement, I guess you want everything to start when you choose Start from the menu? So in that case it's the startRecord function.

    Right now, after recording is started, accelHandler is called for each measurement, so you just need to change that do something like this:

    function accelHandler(accel) {
        var t = getTime()-start;
        // get max value from all axes
        var maxValue = Math.max(Math.abs(accel.x), Math.abs(accel.y), Math.abs(accel.z));
        // write time and max value
        /* we only want to save one value and return? If so remove
        our acceleration listener and go back to the menu... */
        Bangle.removeListener('accel', accelHandler);

Avatar for Gordon @Gordon started