Compare commits

..

6 commits

Author SHA1 Message Date
boutrie.eytan bc8b071a5a code Accel 2023-06-14 14:41:30 +02:00
boutrie.eytan d7a7796041 code Accel 2023-06-14 14:40:29 +02:00
boutrie.eytan f87d32fda6 code Accel 2023-06-14 10:40:56 +02:00
boutrie.eytan 363dbdd61a code Accel 2023-06-14 10:31:58 +02:00
boutrie.eytan 2033044d41 code Accel 2023-06-14 10:18:14 +02:00
boutrie.eytan 7b01756edc code Accel 2023-06-14 10:15:38 +02:00
2 changed files with 11 additions and 16 deletions

View file

@ -1,2 +1 @@
#Rotabator

View file

@ -35,11 +35,7 @@ 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;
@ -58,20 +54,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);
if((micros() - previousTime) >= interval){
previousTime = micros();
pinState = !pinState;
digitalWrite(stepPin,pinState);
Serial.println(IMU.getAccelX_mss() + IMU.getAccelY_mss() + IMU.getAccelZ_mss() + biai +11);
}
delay(200);
}