This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
chumbyhackerboard:i2c [2010/08/28 22:11] ladyada |
chumbyhackerboard:i2c [2010/08/28 22:14] ladyada |
||
---|---|---|---|
Line 95: | Line 95: | ||
You can grab all of the code below | You can grab all of the code below | ||
+ | |||
+ | Stick the code in a new file called **mma7455.c** by copying and pasting as before. Then compile by running **gcc -o mma7455 mma7455.c** and run with **./mma7455**. Now shake it! | ||
+ | |||
+ | {{:chumbyhackerboard:shaken.gif|}} | ||
+ | |||
+ | There you go! Now you can talk to the accelerometer to get motion data, and this code is easily adaptable for any i2c chip you may want to use. Enjoy! | ||