TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: creativecontrol on January 05, 2016, 04:56:28 AM

Title: Wireless IMU
Post by: creativecontrol on January 05, 2016, 04:56:28 AM
I am trying unsuccessfully to get a 9DOF IMU and any form of wireless communication working. I've tried the CC3000 WiFi and the Nordic BLE shields. It seems like the libraries are just too big. I've even gone through and commented out as many of the Serial.print() functions as I can to try to save space but I'm stuck at just over 32,200 bytes and it won't load. Does anyone have any ideas or a working example of a wireless Tinyduino IMU? Below is my current code (I switched to the RedBear nRF8001 libs thinking it might be lighter). Thanks!!

Code: [Select]
#include <Wire.h>
#include "I2Cdev.h"
#include "RTIMUSettings.h"
#include "RTIMU.h"
#include "RTFusionRTQF.h"
#include "CalLib.h"
#include <EEPROM.h>
#include <SPI.h>

#include "boards.h"
#include "RBL_nRF8001.h"
#include "services.h"

RTIMU *imu;                                           // the IMU object
RTFusionRTQF fusion;                                  // the fusion object
RTIMUSettings settings;                               // the settings object

//  DISPLAY_INTERVAL sets the rate at which results are displayed

#define DISPLAY_INTERVAL  300                         // interval between pose displays

//  SERIAL_PORT_SPEED defines the speed to use for the debug serial port

#define  SERIAL_PORT_SPEED  115200

void setup()
  // Initialize BLE library.

  // Set a custom BLE name.
  imu = RTIMU::createIMU(&settings);                        // create the imu object

void loop()
    if (imu->IMURead()) {                                // get the latest data if ready yet
      fusion.newIMUData(imu->getGyro(), imu->getAccel(), imu->getCompass(), imu->getTimestamp());
      int pose = fusion.getFusionPose().x();
      ble_write_bytes((byte*)&pose, 2);

// Process BLE events.