Created
December 10, 2013 20:41
-
-
Save turbinenreiter/7898850 to your computer and use it in GitHub Desktop.
Arduino code to send acceleration data to serial port.
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
#include <MPU6050.h> | |
#include <I2Cdev.h> | |
#include <Wire.h> | |
MPU6050 accelgyro; | |
int ax, ay, az; | |
int gx, gy, gz; | |
int led = 13; | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// initialize serial communication at 9600 bits per second: | |
Serial.begin(9600); | |
Wire.begin(); | |
accelgyro.initialize(); | |
pinMode(led, OUTPUT); | |
digitalWrite(led, HIGH); | |
accelgyro.setFullScaleAccelRange(1); | |
} | |
// the loop routine runs over and over again forever: | |
void loop() { | |
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); | |
Serial.println(ax); | |
delay(50); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment