Quote:
|
Originally Posted by prograid
I'm not sure about this, but I believe that the EDU controller shares pins for digital and analog inputs. You need to set the input your gyro is plugged into to be an analog input in user_initialization() which is user_routines.c.
Good Luck!
|
Considering he gets a valid gyro bias and rate, the problem is not the reading.
jaustin,
gyro_angle is declared as a long in Kevin's code. The comments section of printf_lib.c states that you should use %lx, but I have never tried that.
What will work (and what Kevin's code does in another section) is to type-cast the long variable. You should print it like that:
Code:
temp_gyro_angle = Get_Gyro_Angle();
printf("Gyro Angle=%d\r\r", (int)temp_gyro_angle);
Depending on what compiler version you're using, it should be \r or \n.
Anyway, on your code you're printing three times inside the Process_Gyro_Data function. This is an interrupt service routine, and it should be processed as fast as possible. Printf takes a lot of time, and it is unwise to use it three times (actually, to use it at all) inside an ISR.
Check user_routines.c on Kevin's code, there are some examples that will print exactly what you want without "side effects".