Plug in a USB cable connecting your Flora to your computer.
Download the Adafruit_LSM303 library from Github by clicking the ZIP button. Unzip the downloaded file and rename the resulting folder "Adafruit_LSM303," then move it to your Arduino libraries folder.We have a very detailed tutorial on installing Arduino libraries here, so please read it if you are having difficulties installing the library right!
Open the special Adafruit version of the Arduino IDE and naviate to File-->Examples-->Adafruit_LSM303-->Test to open the accelerometer test sketch. For more information on programming the Flora, check out the Getting Started with FLORA
Be sure you have the correct serial port and board type selected under the Tools menu, then upload the sketch to your Flora.
Open the serial monitor and watch the accelerometer values pour in!
Modify this sample sketch to integrate this sensor into your project. Debugging over USB is helpful to see the ranges of numbers your sensor provides, but once your code is solid, you can disconnect from the computer and power your project with a 3xAAA battery holder.
Last updated on 2015-02-28 at 11.30.13 AM
Published on 2013-02-05 at 10.58.39 PM