in this thread I asked about testing the kit gyro and was given a programming answer, so I will continue my programming question here.
I am wanting the easiest way to test my gyro to see if it is dead.
I have the kit gyro hooked up with a PWM cable, with the white cable connected to TW(twist), the black cable connected to GB (ground), and the red cable to 5R (+5V). I plug it into the Robot Controllers Analog input 1 with the colors corresponding to those on the inputs.
In my code, under user_routines.c I have added the following
I am definitely hooked to TW (twist) and not RW (relative temperature).
At this point I am really just wanting to see a number that changes when I move the gyro chip. Am I doing something wrong or do I have a dead gyro? Is there an easier way to see if it is dead?
Get_Analog_Value returns an int, so you should declare yawtest as an int. Also, the %d in the printf expects an int.
double is a floating point type, which should be avoided whenever possible on the robot controller since it does not have a floating point unit, so all floating point must be done by software and is very big and slow.
I made the changes above to make my variable an int, but saw no difference.
Does anyone have any suggestions for testing our kit gyro to see if it is alive? Is there a way to do it with a voltage meter?
does Get_Analog_Value( rc_ana_in01 ) return a value that should change when the gyro chip is rotated, or do you have to initialize the gyro before it will function at all?
An important point to understand about the gyro is it only returns a rate of rotation while it is moving. This rate is around 2.5 vdc when still. So, the software needs to integrate the variation in rate over time to give you an angle relative to it’s original angle. So, the answers given in the programming section may contain your solution.
Sorry if this was already explained, but that is what happens when you “cross-post”.
As for using a multi-meter to test it may be difficult. If I recall correctly, the KOP gyro’s output changes by 12mv/deg/s of rotation and is limited to 80 deg/sec. You would need a very fast and sensitive meter to catch it. So, try connecting the meter between T and gnd. Rotate the gyro by hand and see if the output changes during rotation. The other alternative is to use a o’scope.