Step 43: IMU testing sketch
Paste it into an empty new Arduino sketch window and it will then work.
Updated Feb 25th 2012
It works with Arduino V22. They have now released a newer version (V1.0) with a new softserial library with slightly different softserial commands so it might not work with very latest version of Arduino.
MAKE SURE ARDUINO POWERED BY A BATTERY NOT JUST THE USB LEAD, ELSE ACCEL READINGS CHANGE.
Open serial view window.
Accel readings will be about right and zero when board more or less level. Gyro will read about zero except for when you are actively tipping the board one way or the other.
However when you tilt the board so accel values go +ve, the gyro values should TRANSIENTLY go more +ve also.
They will go transiently -ve as accel angle goes -ve when you are tilting it the other way.
If this happens then you have your accel and gyro mounted correctly!
NOTE: Read text at start of the sketch. At some stage when running this sketch, hold you board straight and level, then write down the value "accsum" displayed on the screen. If it substantially different from my default value of 338, you will need to change the value of 338 in subsequent code to a new value.
IF YOU NEED TO DO THIS:
Open this sketch again and change the value of 338 in the line of code: x_accdeg = (float)((accsum - 338) * 0.862);
Insert the value you obtained for accsum when you were holding board level earlier instead of the 338 (it should be about 338).
This procedure will make sure your board balances more or less level and compensates for any slight offset from vertical your IMU mounting might have.
Recompile, load and run this IMU tester sketch again.
1) tipstart should engage when board is very nearly level.
2) The accel should read zero, angle should be displayed as zero and both should go -ve or +ve as you tilt board one way or the other from the level point.