futuremeng 发表于 2014-2-21 23:44:28

6DOF shield ITG3205+ADXL345和Arduino Yun

把6DOF直接插在Yun上,然后用例子代码:

////////////////////////////////////////////////////////////
// Arduino firmware for use with FreeSixCube processing example
////////////////////////////////////////////////////////////

#include <FreeSixIMU.h>
#include <FIMU_ADXL345.h>
#include <FIMU_ITG3200.h>

#define DEBUG
#ifdef DEBUG
#include "DebugUtils.h"
#endif

#include "CommunicationUtils.h"
#include "FreeSixIMU.h"
#include <Wire.h>


float q; //hold q values

// Set the FreeIMU object
FreeSixIMU my3IMU = FreeSixIMU();

void setup() {
Serial.begin(115200);
Wire.begin();

delay(5);
my3IMU.init();
delay(5);
}


void loop() {
my3IMU.getQ(q);
serialPrintFloatArr(q, 4);
Serial.println(""); //line break

delay(60);
}



上传时报错如下:

Sketch uses 15,284 bytes (53%) of program storage space. Maximum is 28,672 bytes.
Global variables use 522 bytes (20%) of dynamic memory, leaving 2,038 bytes for local variables. Maximum is 2,560 bytes.
Found programmer: Id = "S"; type = p
    Software Version = V. ; Hardware Version = v.

avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
processing.app.debug.RunnerException
        at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:129)
        at processing.app.Sketch.upload(Sketch.java:1672)
        at processing.app.Sketch.exportApplet(Sketch.java:1578)
        at processing.app.Sketch.exportApplet(Sketch.java:1550)
        at processing.app.Editor$DefaultExportHandler.run(Editor.java:2399)
        at java.lang.Thread.run(Unknown Source)
Caused by: processing.app.debug.RunnerException: Problem uploading to board.See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
        at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:113)
        at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:127)
        ... 5 more


请问这是什么情况?该如何解决?

futuremeng 发表于 2014-2-22 00:04:39

// # Editor   : Roy from DFRobot
// # Date       : 10.12.2013
// # E-Mail : roy.yu@dfrobot.com

// # Product name: 6 Dof shield for Arduino
// # Product SKU : DFR0209
// # Version   : 0.1

// # Description:
// # The sketch for driving the 6 Dof shield for Arduino via I2C interface

#include <FreeSixIMU.h>
#include <FIMU_ADXL345.h>
#include <FIMU_ITG3200.h>

#include <Wire.h>

int16_t angle; // pitch & roll

// Set the FreeSixIMU object
FreeSixIMU sixDOF = FreeSixIMU();
int rawSixDof;
void setup()
{
Serial.begin(9600);
Wire.begin();
   
delay(5);
sixDOF.init();                        //begin the IMU
delay(5);
}

void loop() {
   
sixDOF.getRawValues(rawSixDof);
for (int i=0; i<6; i++)            //output the raw data
{
    switch (i)
    {
      case 0:
      Serial.print("Acc.x :");
      break;
      case 1:
      Serial.print("Acc.y :");
      break;
      case 2:
      Serial.print("Acc.z :");
      break;
      case 3:
      Serial.print("gyro.x :");
      break;
      case 4:
      Serial.print("gyro.y :");
      break;
      case 5:
      Serial.print("gyro.z :");
      break;
      default:
            Serial.print("Err");
    }
    Serial.println(rawSixDof);
}
Serial.println("");
angle = _atan2(rawSixDof,rawSixDof);
angle = _atan2(rawSixDof,rawSixDof);
   
Serial.print("X:");            //pitch & roll
Serial.println(angle/10.0);
Serial.print("Y:");
Serial.println(angle/10.0);
Serial.println("");
delay(1000);
}

int16_t _atan2(int32_t y, int32_t x)   //get the _atan2
{
float z = (float)y / x;
int16_t a;
if ( abs(y) < abs(x) )
{
    a = 573 * z / (1.0f + 0.28f * z * z);
    if (x<0)
    {
    if (y<0) a -= 1800;
    else a += 1800;
    }
}
else
{
    a = 900 - 573 * z / (z * z + 0.28f);
    if (y<0) a -= 1800;
}
return a;
}

这个可以,来自http://www.dfrobot.com/wiki/index.php/6_Dof_Shield_(DFR0209) 还没明白什么意思,先能跑了再说,呵呵。

下面这个也可以,来自6 Dof shield library\FreeSixIMU\examples\sixDOF_Example

#include <FreeSixIMU.h>
#include <FIMU_ADXL345.h>
#include <FIMU_ITG3200.h>

#include <Wire.h>

float angles; // yaw pitch roll

// Set the FreeSixIMU object
FreeSixIMU sixDOF = FreeSixIMU();

void setup() {
Serial.begin(9600);
Wire.begin();

delay(5);
sixDOF.init(); //begin the IMU
delay(5);
}

void loop() {

sixDOF.getEuler(angles);

Serial.print(angles);
Serial.print(" | ");
Serial.print(angles);
Serial.print(" | ");
Serial.println(angles);

delay(100);
}

Grey 发表于 2014-4-14 14:52:24

avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
好像可以通过更改串口,或者避免使用USB3.0 来解决这个问题
页: [1]
查看完整版本: 6DOF shield ITG3205+ADXL345和Arduino Yun