Skip to content

Instantly share code, notes, and snippets.

@turbinenreiter
Created December 10, 2013 20:41

Revisions

  1. turbinenreiter created this gist Dec 10, 2013.
    29 changes: 29 additions & 0 deletions writeserial
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #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);

    }