I have an Arduino Uno, an Arduino Nano, a Teensy 3.0 and a 3-axis gyroscope (L3G4200D module from Parallax http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/gyroscope/List/0/SortField/4/ProductID/778/Default.aspx)
When I hook up the Arduino Nano or Arduino Uno to the gyroscope and use the sample code provided at the bottom of this page, it works great: http://learn.parallax.com/kickstart/27911
I get the readings I expect from the gyroscope.
When I hook up the same gyroscope to my Teensy 3.0, I get readings... but they aren't quite right. Instead of reading (x, y, z) 0, 0, 0 at rest, it will read 574, 0, 574. Sometimes 574, 0, 0, and sometimes 574, 574, 574.
When I move the module around, though, the numbers read closer to what I would expect from the Arduino boards.
I'm still very new to hardware. I understand some of the basics, and I know enough to make sure I have all the right wires plugged in to the right pins, etc. I'm sure there is something in the sample code that I'm using causing the problem - after all, this is arduino sample code that I'm using with a teensy...
I'm coding in the Arduino IDE w/ the TeensyDuino add-on. I have the board configured correctly in the Arduino options, of course.
Does anyone have any idea why my X and Z axis are reading 574 most of the time? What do I need to do to fix this?
Per comment requests, here are images of my setup.
The Teensy setup: http://cl.ly/image/0E3R0x380d3R
The Arduino Nano setup: http://cl.ly/image/2S1J03123L16
As you can see, the setup is the same - just putting the pins in the right place for the controller I'm using. The Nano produces the correct results, while the Teensy does not.
Would the Arduino being 16 bit while the Teensy being 32 bit cause problems? Do I need to adjust the math to calculate the two's complement differently? Use different variable types to store the resulting information? Or am I thinking wrong on this path?