#include <Servo.h>
#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu(Wire);
Servo servox;
Servo servoy;
const int smax = 180;
const int smin = 0;
void setup(void) {
Wire.begin();
mpu.begin();
mpu.calcGyroOffsets(true);
servox.attach(11);
servoy.attach(10);
servox.write(90);
servoy.write(90);
}
void loop() {
mpu.update();
float pospesekx = mpu.getAccX();
float pospeseky = mpu.getAccY();
int kotx = map(pospesekx * 100, -100, 100, smin, smax);
int koty = map(pospeseky * 100, -100, 100, smin, smax);
servox.write(kotx);
servoy.write(koty);
delay(50);
}