Jump to content
I2Cdevlib Forums

mariocaptain

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by mariocaptain

  1. Thanks a lot for the answer! That makes sense to me, that being the case then it's a big pity for the 6050, since it will limit the applications. Well for my application which is a balancing robot, I need to know the exact time elapsed between two consecutive readings (hence the original IRS set at 60Hz), so to move the function to the main loop and use something like micros() to keep track of the time, I would just move everything else with it then... Wish I could do the IRS because it would make the code very tidy. Does anyone have any experience using the MPU-6000 (exactly like the MPU-6050 but also comes with SPI interface) inside an IRS? Or do you think it will work? Thanks, Dave
  2. Hi all, I have been using Jeff's MPU6050 Arduino library with great results. However, in my current project, I want to put getAccelerationX() (or getMotion6() for that matter) inside an IRS (ISR(TIMER2_COMPA_vect) specifically) in order to poll the MPU6050 at precise intervals (about 60Hz). But for some reason the code will hang inside the function getAccelerationX(). Is this some kind of interrupt conflict? I would like to know if there is anyway to work around this. For a quick reference, this is the code of getAccelerationX(): int16_t MPU6050::getAccelerationX() { I2Cdev::readBytes(devAddr, MPU6050_RA_ACCEL_XOUT_H, 2, buffer); return (((int16_t)buffer[0]) << 8) | buffer[1]; } I am using a standalone Arduino UNO, with timer0 untouched, and timer1 already used to control some motors. Will it work if I use an AVR with more timers (3,4,5) and use one of those instead of timer2 above? Thanks in advance, Dave
×
×
  • Create New...