Hilfe bei Projekt

Hallo Gemeinde,
Ich bin ein Neuling in diesem Gebiet, daher wollte ich fragen ob mir jemand helfen kann diesen Code hier für ein mpu6050 Sensor board umzuschreiben helfen kann?

Link zum eig Programm:
http://www.instructables.com/files/orig/FI9/5GMI/HSBSL7OA/FI95GMIHSBSL7OA.txt

Ich nutze die "FreeIMU" lib.

Und mein Board ist ein MPU6050.

Vielen Dank schon mal

Mfg Basti

Dir kann bestimmt geholfen werden

Aber?

Wo kein Kläger da kein Anwalt

das versteh ich jetz leider nicht. :frowning: (Also das sprichtwort an sich schon)

können sie mir helfen?

mfg

Wieso umschreiben? Es gibt fertige MPU6050 Bibiotheken.

http://playground.arduino.cc/Main/MPU-6050

ja das weiß ich =)
nur mein problem ist das ich das programm im link sehr schlecht verstehe
und ich wollte fragen ob man das villeicht jemand mit mir zusammen auf ein mpu6050
umschreiben kann und nicht und nicht lib verwendet?

mfg

ich bekomme ja nicht mal den "tester code" zum laufen weil ich ihn nicht verstehe :((

http://www.instructables.com/files/orig/FCO/0DMT/HSHDU23L/FCO0DMTHSHDU23L.txt

Du musst das Problem genauer beschreiben. Was geht genau nicht? Kompiliert es? Wird überhaupt irgendwas angezeigt?

ok tut mir leid bei dem "Tester code" geht ganix da kommen nur Nullen raus keine zahlen.
es kompiliert alles nur ich glaube der i2c wird bei dem code anders angesprochen wie bei der mpu6050 lib.
weil die bsp mit mpu6050 gehen alle wunderbar.

mfg

Wo keine Fragen, da keine Antworten :smiley:

Serenifly:
Du musst das Problem genauer beschreiben. Was geht genau nicht? Kompiliert es? Wird überhaupt irgendwas angezeigt?

Genau dass meinte ich

ok ich probiers anders kann man diesen code hier so umschreiben das er für ein mpu6050 funktioniert?

mfg

//John Dingley 08/03/2014   IMU TESTING PROFRAM
//This program modified slightly from Piddybot program see below. If you wire up the Sparkfun Digital IMU and connect
//the USB lead to your computer and open the Serial View window (9600 Baud)
//then when you move the IMU from the flat position you will see the displayed "angle" varies from zero when level
//through -ve values when tilted one way to +ve similar sized values when tilted the other way.

//This code therefore allows you to test your IMU is working OK and talking to the Arduino before attaching the Sabertooth power controller
//or attaching the deadman switch, steering rocker switch or the balance point fine tuning rocker switch.

// Modified from PIDDYBOT Self Balancing Program
// Program Written and Pieced together by Sean Hodgins.
// The program was morphed from many programs.
// With that being said If you feel you see something that
// is your work and want credit, feel free to contact me.
// Http://Idlehandsproject.com
// This is free to be shared, altered, and used. 
// It is in no way "Finished".
// Find the Second target angle and tune for your bot, it may be different.
// LIBRARIES
#include <Wire.h>
#include <FreeSixIMU.h>
#include <FIMU_ADXL345.h>
#include <FIMU_ITG3200.h>

FreeSixIMU sixDOF = FreeSixIMU();


const int AvgAngles = 3;
 float prevTargetAngle = 0;
 float targetAngle = 0;


float angles[5];

float currAngle, prevAngle;
float prevAngles[AvgAngles];
int prevAngleI = 0;

// time vars
int currTime = 0; 
int prevTime = 0; 



float errorSum = 0;
float currError = 0;
float prevError = 0;
float iTerm = 0;
float dTerm = 0;
float pTerm = 0;

//Location PID CONTROL - These are the PID control for the robot trying to hold its location.
  float Lp = 0.5;
  float Li = 0.05;
  float Ld = 0.4;
  float offsetLoc = 0;
  float pT,iT,dT = 0;
  float errorS = 0;
  float prevE = 0;

void setup() {

  
  // Serial Connection
  Serial.begin(9600);

  // IMU Connection
  Wire.begin(); 

  delay(5);
  sixDOF.init(); //Begin the IMU
  delay(5);

}


void loop() {

  updateAngle();
  Serial.println(currAngle);
  delay(500);
  
}

  
void updateAngle() {
  sixDOF.getYawPitchRoll(angles);
  prevAngles[prevAngleI] = angles[1];
  prevAngleI = (prevAngleI + 1) % AvgAngles;
  float sum = 0;
  for (int i = 0; i < AvgAngles; i++)
      sum += prevAngles[i];
  currAngle = sum / AvgAngles;
  prevAngle = currAngle;
  
}

ich bekomme ja nicht mal den "tester code" zum laufen weil ich ihn nicht verstehe

Da nutzt es ja auch nix, wenn Ihnen jemand was anderes schreiben würde, was Sie auch nicht verstehen :wink:

Ja da haben sie leider recht aber es wäre ein anfang um danach den hauptcode umzuschreiben.

mfg

Kannst ja die paar Zeilen erklären

Also wenn ich mir das so anschaue, dann verwendet der code Libs für das ADXL345 (Beschleunigung) und für das ITG3200 (Gyro). ohne, dass da etwas an den Bibliotheken geändert wird glaub ich nicht, dass du das so einfach umschreiben kannst. Damit das Sinn bekommt, musst du dir die Funktionen/Befehle der 2 LIBs mit den Befehlen der Bibliothek für das MPU6050 (Kombo Beschleunigung und Gyro) vergleichen und dann umschreiben, ob das so einfach ist, wage ich zu bezweifeln...

Willst den code für einen self balancing robot verwenden? dann google nach
"mpu6050 arduino self balancing robot"

evtl. hilft auch das weiter...