Plug in a USB cable connecting your Flora to your computer.

Download the Adafruit_LSM303 library from the Arduino Library Manager.

Open up the Arduino Library Manager:

Search for the Adafruit LSM303 library and install it

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 guide.

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.

This guide was first published on Feb 05, 2013. It was last updated on Feb 05, 2013.

This page (Programming) was last updated on Feb 05, 2013.

Text editor powered by tinymce.