Hi everyone,
I have a little project with ArduIMUV3.
The point is to detect a complete revolution 360° on roll, pitch and yaw axis, and lit up one of the leds.
I can't find where is the part in ArduIMU 1.9 code that gives the initial values of roll pitch and yaw, I would like to use these as my initial conditions to start counting a rotation on each axis.
I have tried and adapted this code found on the web for yaw, add it to the DCM file and call the function in arduimu file but no chance, also because I don't know how to get the initial values:
void ThreeSixty(float ActualYAW)
{
float prev_yaw;
float yawDeg = ToDeg(ActualYAW);
boolean cp_pi;
float yaw = yawDeg;
Serial.println(yawDeg);
if ((yaw == 180) || (yaw == 0)) return;
if (yaw * prev_yaw < 0)
{
float d_yaw = (yaw - prev_yaw);
if (d_yaw < 0)
{
cp_pi = ! cp_pi;
}
else if (cp_pi)
{
// fire detection event
Serial.print("ThreeSixtyYAW");
Serial.print(ActualYAW);
Serial.print("");
digitalWrite(RED_LED_PIN,HIGH);
digitalWrite(BLUE_LED_PIN,LOW);
}
}
prev_yaw = yaw;
}
Thanks a lot,
Best Regards,
arduimu.pde (20.1 KB)
DCM.pde (11.3 KB)