Evan Brown
/
APpart3_E_start
11/18
main.cpp@2:a4d5e7f96e87, 2018-11-15 (annotated)
- Committer:
- tlee6414
- Date:
- Thu Nov 15 01:36:16 2018 +0000
- Revision:
- 2:a4d5e7f96e87
- Parent:
- 0:f43994f44684
- Child:
- 3:461a9012682d
11/14/18
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tlee6414 | 2:a4d5e7f96e87 | 1 | #include "sensor_fusion.h" |
evenbrownie | 0:f43994f44684 | 2 | |
tlee6414 | 2:a4d5e7f96e87 | 3 | MPU6050 mpu(SDA,SCL); |
evenbrownie | 0:f43994f44684 | 4 | |
evenbrownie | 0:f43994f44684 | 5 | int main() { |
tlee6414 | 2:a4d5e7f96e87 | 6 | mpu.start(); |
tlee6414 | 2:a4d5e7f96e87 | 7 | |
evenbrownie | 0:f43994f44684 | 8 | while(1) { |
tlee6414 | 2:a4d5e7f96e87 | 9 | if (!mpu.data_ready()) { |
tlee6414 | 2:a4d5e7f96e87 | 10 | continue; |
tlee6414 | 2:a4d5e7f96e87 | 11 | } |
tlee6414 | 2:a4d5e7f96e87 | 12 | |
tlee6414 | 2:a4d5e7f96e87 | 13 | float accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z; |
tlee6414 | 2:a4d5e7f96e87 | 14 | mpu.read_raw(&gyro_x, &gyro_y, &gyro_z, &accel_x, &accel_y, &accel_z); |
tlee6414 | 2:a4d5e7f96e87 | 15 | |
tlee6414 | 2:a4d5e7f96e87 | 16 | printf("ax:%f\n ay: %f\n az: %f\n gx: %f\n gy: %f\n gz: %f\r\n", accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z); |
tlee6414 | 2:a4d5e7f96e87 | 17 | printf("____________________\n"); |
tlee6414 | 2:a4d5e7f96e87 | 18 | wait(1); |
evenbrownie | 0:f43994f44684 | 19 | } |
tlee6414 | 2:a4d5e7f96e87 | 20 | } |