Professional Documents
Culture Documents
Script Stabilizer
Script Stabilizer
h"
#include "I2Cdev.h"
#include "MPU6050.h"
#include "Servo.h"
MPU6050 mpu;
Servo myservo1;
Servo myservo2;
Servo myservo3;
int val;
int prevVal;
void setup()
{
Wire.begin();
Serial.begin(38400);
Serial.println("Initialize MPU");
mpu.initialize();
Serial.println(mpu.testConnection() ? "Connected" : "Connection failed");
myservo1.attach(9);
myservo2.attach(10);
myservo3.attach(11);
}
void loop()
{
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
delay(50);
}