D:/DRISSI/arduino-0022/arduino-0022/libraries/inclinometer/inclinometer.cpp
Go to the documentation of this file.
00001 
00005 /* Get inclinometer value for axis X or Y */
00006 
00007 #include "inclinometer.h"
00008 
00009 
00010 // Return Roll (around the X axis)
00011 double  GetRoll ()
00012 {
00013 #ifdef __DEBUG__INC__
00014         Serial.println("Getting roll...");
00015 #endif
00016 
00017         double VoutX = analogRead(A1);                                          // Read analog value return by the inclinometer for X axis
00018         return -asin (( ((VoutX*5.0)/1023.0) -2.5) /2.0);       // Return the angle
00019 }
00020 
00021 
00022 // Return Pitch (around the Y axis)
00023 double GetPitch()
00024 {
00025 #ifdef __DEBUG__INC__
00026         Serial.println("Getting pitch...");
00027 #endif
00028 
00029         double VoutY = analogRead(A0);                                          // Read analog value return by the inclinometer for Y axis
00030         return -asin (( ((VoutY*5.0)/1023.0) -2.5) /2.0);       // Return the angle
00031 }
00032 
00033 
00034