Problem with timing a measurement

I’m building a heart-rate monitor with a built in accelerometer as a research project. I’m using the Yún board for this because of the built-in SD compatibility. I have not yet started implementing the heart rate part, since I’ve got stuck on the accelerometer. I can measure properly, but I can’t seem to time the measurement. Since I want to be able to later do an FFT on the heart rate, and would like to only use one file for the data I would like for the measurement to happen at regular intervals.

I have managed to use timers to blink a LED and print some stuff, and I have managed to use all the components I want to use in the code together (timers, accelerometer, SD-card), but not quickly enough (due to the filesystem being slow in the connection) which made me use the QueueArray class as a FIFO.

When I load this sketch below to the board nothing happens. The sketch seems to upload correctly according to the IDE, but only the ON LED is lighting up, as opposed to when the measurement works and all LEDs, except WiFi, light up. Does anyone have any idea as to what might be going on?

// include queue library header.
#include <QueueArray.h>
#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050.h"
#include <FileIO.h>
// declare a string message.
const String msg = "Happy Hacking!";
MPU6050 accelgyro;
#define ledPin 13
int timer1_counter;
int16_t ax, ay, az;
int16_t gx, gy, gz;
int16_t mx, my, mz;
int time;
//String DataString;
// create a queue of characters.
QueueArray <int> queue;
File dataFile;
// startup point entry (runs once).
void setup () {
  // start serial communication.
  Serial.begin (9600);
    pinMode(ledPin, OUTPUT);
  // set the printer of the queue.
  queue.setPrinter (Serial);

   noInterrupts();           // disable all interrupts
  TCCR1A = 0;
  TCCR1B = 0;

  // Set timer1_counter to the correct value for our interrupt interval
  //timer1_counter = 64886;   // preload timer 65536-16MHz/256/100Hz
  //timer1_counter = 64286;   // preload timer 65536-16MHz/256/50Hz
  timer1_counter = 3286;   // preload timer 65536-16MHz/256/10Hz
  TCNT1 = timer1_counter;   // preload timer
  TCCR1B |= (1 << CS12);    // 256 prescaler 
  TIMSK1 |= (1 << TOIE1);   // enable timer overflow interrupt
  interrupts();             // enable all interrupts

//Function to be triggered by the timer
ISR(TIMER1_OVF_vect)        // interrupt service routine 
  TCNT1 = timer1_counter;   // preload timer
  digitalWrite(ledPin, digitalRead(ledPin) ^ 1);
        accelgyro.getMotion9(&ax, &ay, &az, &gx, &gy, &gz, &mx, &my, &mz);

    int DataArray[10]={time,ax,ay,az,gx,gy,gz,mx,my,mz};
    for (int i = 0; i < 10; i++)
    queue.push (DataArray[i]);
// loop the main sketch.
loop () {

  // pop all the message's characters from the queue.
  while (!queue.isEmpty ()){

    Serial.println (queue.pop());



Missing “#include <Bridge.h>” ?

Well, yes, that one was missing. But it didn't solve the problem.

I have a working sketch where the measurement is taken in loop() and the timer is only used to blink a LED. This is, however, not what I want to do. I need to be able to time the measurement.

Since I can get it to work when the measurement is outside the ISR i suspect the problem lies in the measurement being an interrupt, and interrupts being disabled inside the ISR. This is what I was trying to address by including the interrupts(); command in the ISR.