Compare commits

..

2 commits

2 changed files with 16 additions and 11 deletions

View file

@ -1 +1,2 @@
# Rotabator

View file

@ -35,7 +35,11 @@ S20A is 3.3V voltage regulator MIC5205-3.3BM5
#include "MPU9250.h"
float biai = 1.25;
unsigned long previousTime;
int interval = 300;
int stepPin = 14;
int dirPin = 12;
bool pinState = LOW;
// an MPU9250 object with the MPU-9250 sensor on I2C bus 0 with address 0x68
MPU9250 IMU(Wire,0x68);
int status;
@ -54,20 +58,20 @@ void setup() {
Serial.println(status);
while(1) {}
}
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
// read the sensor
digitalWrite(dirPin,HIGH);
IMU.readSensor();
// display the data
Serial.print("AccelX: ");
Serial.print(IMU.getAccelX_mss(),2);
Serial.print(" ");
Serial.print("AccelY: ");
Serial.print(IMU.getAccelY_mss(),2);
Serial.print(" ");
Serial.print("AccelZ: ");
Serial.println(IMU.getAccelZ_mss() + biai,2);
delay(200);
if((micros() - previousTime) >= interval){
previousTime = micros();
pinState = !pinState;
digitalWrite(stepPin,pinState);
Serial.println(IMU.getAccelX_mss() + IMU.getAccelY_mss() + IMU.getAccelZ_mss() + biai +11);
}
}