Help please, I'm about to give up

Ive been trying to get my GY-80 sensor working for about two days and i have managed to get some output code from the X,Y,Z axis.

Im having no luck at all finding a program that will let me see an AHRS 3D display. I have tried a few for other sensors that i found, like the Razor using the Processing program but non will work with the GY-80

All help is greatly apreciated.

seen this? http://blog.oscarliang.net/use-gy80-arduino-adxl345-accelerometer/

Thanks for the reply. Yes i have tried that one and i can't get the green square to move at all i can get the sensor putting out the data in the serial monitor looking like this.

89.71:33.71
89.78:56.60
89.80:72.72
89.93:-175.65
89.88:56.38
89.83:114.47
89.78:127.51
89.81:152.43
89.73:64.43
89.86:64.43
89.82:113.77
89.80:70.31
89.76:55.18

But when i open the Processing 2.2.1 all i get is a motionless square. I have set the serial port to the correct one to.. Its got me stumped :angry:

Its got me stumped

No code. No wiring diagram. No wonder you're stumped.

Update, managed to get it working its definitely not working well i have to start the Processing program about four times to get it to work its like an old engine trying to fire up lol.

The square is not solid but disjointed at the corners and moves around very glitchy but I'm very happy as it some movement.

I suppose the next step is try to stabilise it :sob:

This is the code i finally got it working with well i say working working very badly. If anyone can spot anything drastically wrong please feel free to point it out

#include <Wire.h>
#include <ADXL345.h>

const float alpha = 0.5;

double fXg = 0;
double fYg = 0;
double fZg = 0;

ADXL345 acc;

void setup()
{
acc.begin();
Serial.begin(9600);
delay(100);
}

void loop()
{
double pitch, roll, Xg, Yg, Zg;
acc.read(&Xg, &Yg, &Zg);

//Low Pass Filter
fXg = Xg * alpha + (fXg * (1.0 - alpha));
fYg = Yg * alpha + (fYg * (1.0 - alpha));
fZg = Zg * alpha + (fZg * (1.0 - alpha));

//Roll & Pitch Equations
roll = (atan2(-fYg, fZg)180.0)/M_PI;
pitch = (atan2(fXg, sqrt(fYg
fYg + fZg*fZg))*180.0)/M_PI;

Serial.print(pitch);
Serial.print(":");
Serial.println(roll);

delay(10);
}

And this is the Processing code:

import processing.serial.*;

Serial fd;

int pitch = 0;
int roll = 0;

void setup ()
{
size(640, 360, P3D);
//Connect to the corresponding serial port
fd = new Serial(this, Serial.list()[5], 9600);
// Defer callback until new line
fd.bufferUntil('\n');
}

void draw ()
{
//Set background
background(0.5);

pushMatrix();

translate(width/2, height/2, -30);

//Rotate
rotateX(((float)pitch)*PI/180.0);
rotateZ(((float)roll)*PI/180.0);

//Print data
print("Pitch: ");
print(pitch);
print(", Roll: ");
println(roll);

scale(90);
beginShape(QUADS);

fill(0, 255, 0); vertex(-1, 1, 1);
fill(0, 255, 0); vertex( 1, 1, 1);
fill(0, 255, 0); vertex( 1, -1, 1);
fill(0, 255, 0); vertex(-1, -1, 1);

fill(0, 255, 255); vertex( 1, 1, 1);
fill(0, 255, 255); vertex( 1, 1, -1);
fill(0, 255, 255); vertex( 1, -1, -1);
fill(0, 255, 255); vertex( 1, -1, 1);

fill(255, 0, 255); vertex( 1, 1, -1);
fill(255, 0, 255); vertex(-1, 1, -1);
fill(255, 0, 255); vertex(-1, -1, -1);
fill(255, 0, 255); vertex( 1, -1, -1);

fill(255, 255, 0); vertex(-1, 1, -1);
fill(255, 255, 0); vertex(-1, 1, 1);
fill(255, 255, 0); vertex(-1, -1, 1);
fill(255, 255, 0); vertex(-1, -1, -1);

fill(255, 0, 0); vertex(-1, 1, -1);
fill(255, 0, 0); vertex( 1, 1, -1);
fill(255, 0, 0); vertex( 1, 1, 1);
fill(255, 0, 0); vertex(-1, 1, 1);

fill(0, 0, 255); vertex(-1, -1, -1);
fill(0, 0, 255); vertex( 1, -1, -1);
fill(0, 0, 255); vertex( 1, -1, 1);
fill(0, 0, 255); vertex(-1, -1, 1);

endShape();

popMatrix();
}

void serialEvent (Serial fd)
{
// get the ASCII string:
String rpstr = fd.readStringUntil('\n');
if (rpstr != null) {
String[] list = split(rpstr, ':');
pitch = ((int)float(list[0]));
roll = ((int)float(list[1]));
}
}

pitch = ((int)float(list[0]));
      roll = ((int)float(list[1]));

Why are you converting the strings to floats and then casting to ints? If you need ints, send ints!

Thanks for the reply i copied the code from the above blog. Im very new to all of this so its a very steep learning curve for me.

What your saying seems logical but i have no idea on how to write the code for that. I did change the "1" to a "0" in the bottom line of code and it made the disjointed box allot more stable.

pitch = ((int)float(list[0]));
roll = ((int)float(list[1]));