multiwii MWC 328p sersors

I have a multiwii MWC 328p FTDI/DSM2 port which is basically an arduino pro mini with a gyroscope, an accelerometer, a magnetometer and an air pressure sensor
I just want to use the sensors on the board and write their values to a serial port or to an outputpin using pwm. I’ve been experimenting with the i2c function. As far as I know the sensors communicate that way. I used this code to read a gyroscope value:

#include <Wire.h>
void setup() {
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600);}
void loop() {
Wire.requestFrom(0x68,0x20 ,0x8F);

while (Wire.available()) {
// char c = Wire.read(); // receive a byte as character
if (Wire.read() >0){
Serial.print(Wire.read());}
}
Serial.println();
delay(1000);
}

But all I got from this are some vague numbers…
It would be really nice to eventually send the axes of the gyro to my arduino mega using pwm or serial communication.
Is there a code I can use that lets me use the sensors on the board or is there someone who can help me?
I’ve been looking way to long for this…
thx

But all I got from this are some vague numbers...

What kind of "vague" numbers? Do the "vague numbers" change as you move the accelerometer?

The numbers I get are in a very strange order. I can't really compare them. Here is an example:
02549525525571455238175255
19302542550
00254000
19202552550
083230819618263255207648264252-1
19302542550
00254000
19302542550
1911002611282461235112468361649255255
193025400-1
0254000-1
025425501253
254000193-1
2288000
2540001930-1
2550091280

Thanks for your reply by the way.

Ifyouprintedsomespacebetweenthevalues,perhapsthevalueswouldmakemoresense.

if you would have read the code than you would've seen that I print every value on a new line...
Is
that
enough
space? :stuck_out_tongue:

Or is there a way to put spaces within the values?

if you would have read the code than you would've seen that I print every value on a new line...

This code?

while (Wire.available()) {
// char c = Wire.read(); // receive a byte as character
if (Wire.read() >0){
Serial.print(Wire.read());}
}

which, if it was properly formatted would look like this:

   while (Wire.available())
   {
      if (Wire.read() >0)
      {
         Serial.print(Wire.read());
      }
   }

So, as long as there is data to read, read one byte and throw it away. Then, read and print another byte JAMMED UP TIGHT AGAIN WHAT WAS PRINTED LAST TIME.

Next time, YOU read the code before spouting off.

I’m sorry, i never meant to be rude.
Arduino is quite new for me. You just brought me one step closer to solving this and I am grateful for that.
Now I get these numbers:

6 0 16 119 223 127 239 4 116 65

194 0 254 255 0

0 0 254 0 0 0

194 0 255 255 0

I still don’t see a change when I move the board…
I have the code which is disigned for this board. (see attachment)
Somewhere in the sensors.cpp tap should be the code which reads the gyro… but I can’t figure it out…

MultiWii.zip (167 KB)

I tried something else and this is what I have now.
Can you make something out of this?

serial code.txt (71.9 KB)

I used this code to read a gyroscope value

Without knowing which bytes mean what, that is useless data.

You have some specific gyroscope. The manufacturer will define what the bytes mean. Most likely, at least some of the bytes are part of larger values, like ints or floats, and need to be bit shifted and anded to make sense of the data.

There is quite possibly a library that handles all that for you.