Created
November 18, 2013 14:59
-
-
Save emsk/7529156 to your computer and use it in GitHub Desktop.
加速度データを取得してシリアルポートに出力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Send z-axis acceleration. | |
- LilyPad Arduino USB ... https://www.sparkfun.com/products/11190 | |
- FLORA Accelerometer (LSM303) ... http://www.adafruit.com/products/1247 | |
*/ | |
#include <Wire.h> | |
#include <LSM303.h> | |
LSM303 compass; | |
void setup() { | |
Serial.begin(9600); | |
Wire.begin(); | |
compass.init(); | |
compass.enableDefault(); | |
} | |
void loop() { | |
compass.read(); | |
Serial.println((int)compass.a.z); | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment