Skip to content
Snippets Groups Projects
Commit 332affa8 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

MPU9250 motionlog: initialize values, slightly lower sample rate

parent 7823c649
No related branches found
No related tags found
No related merge requests found
......@@ -8,14 +8,18 @@
#endif
#include "driver/mpu9250.h"
#define INIT0(val) int val = 0, min_ ## val = 0, max_ ## val = 0;
#define UPDATE_MIN(min_val, val) if ((val) < (min_val)) { (min_val) = (val); }
#define UPDATE_MAX(max_val, val) if ((val) > (max_val)) { (max_val) = (val); }
int main(void)
{
int ax, ay, az, gx, gy, gz;
int max_ax, max_ay, max_az, max_gx, max_gy, max_gz;
int min_ax, min_ay, min_az, min_gx, min_gy, min_gz;
INIT0(ax);
INIT0(ay);
INIT0(az);
INIT0(gx);
INIT0(gy);
INIT0(gz);
unsigned char i = 0;
arch.setup();
......@@ -49,17 +53,18 @@ int main(void)
UPDATE_MAX(max_gz, gz);
if (i++ == 200) {
kout << "Temp: " << mpu9250.getTemperature() << endl;
kout << "Min Accel: " << min_ax << " / " << min_ay << " / " << min_az << endl;
kout << "Max Accel: " << max_ax << " / " << max_ay << " / " << max_az << endl;
kout << "Min Gyro: " << min_gx << " / " << min_gy << " / " << min_gz << endl;
kout << "Max Gyro: " << max_gx << " / " << max_gy << " / " << max_gz << endl;
kout << "Temp: " << mpu9250.getTemperature() << endl;
min_ax = min_ay = min_az = 0;
min_gx = min_gy = min_gz = 0;
max_ax = max_ay = max_az = 0;
max_gx = max_gy = max_gz = 0;
i = 0;
}
arch.delay_ms(1);
}
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment