Quote:
|
Originally Posted by Phil_Lutz
But even with the sensor reading 137, when we move the sensor in ANY direction, tilting up/down, or rotating left/right, no change in the 137 value.....
Thanks,
Phil
|
As a double check here is the test code we used on the EDU controller.
Hold the gyro level and twist it quickly 90 degrees or more in the horizontal plane.
Code:
// this assumes in User_Initialization() at least...
IO1 = INPUT;
Set_Number_of_Analog_Channels(ONE_ANALOG);
// in Process_Data_From_Master_uP():
unsigned int gyro;
static unsigned long gyroSum=0;
static unsigned int counter=0;
/* This sample assumes a 26.2ms loop */
gyro = Get_Analog_Value(rc_dig_in01);
gyroSum += gyro;
counter++;
if (counter > 40)
{
gyroSum = gyroSum/counter;
printf(" gyro = %d \n", (int)gyroSum); /* values are in the range 0-1023 */
counter = 0;
gyroSum = 0;
}
[edit] Fixed small bug in printf. We use different print functions, Sorry.