ajout de l'imu pour nucleo
Dependencies: mbed HC_SR04_Ultrasonic_Library IMU_FIP_nucleo Nucleo_Sensor_Shield VL6180x_lib
Revision 7:dc76d89a8d51, committed 2015-04-10
- Comitter:
- quentin9696
- Date:
- Fri Apr 10 22:11:39 2015 +0000
- Parent:
- 2:32226f1d12e5
- Child:
- 8:e3d7a4a34088
- Commit message:
- modif main pour test IMU;
Changed in this revision
| IMU_FIP.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IMU_FIP.lib Fri Apr 10 22:11:39 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/Robotique-FIP/code/IMU_FIP/#89e327e1217f
--- a/main.cpp Tue Mar 31 13:51:26 2015 +0000
+++ b/main.cpp Fri Apr 10 22:11:39 2015 +0000
@@ -1,6 +1,8 @@
#include "mbed.h"
#include "ultrasonic.h"
+#include "Imu.h"
+/*
void dist(int distance)
{
//put code here to happen when the distance is changed
@@ -20,4 +22,51 @@
mu.checkDistance(); //call checkDistance() as much as possible, as this is where
//the class checks if dist needs to be called.
}
+}*/
+
+Imu i;
+Serial pc(SERIAL_TX, SERIAL_RX);
+DigitalOut myled(LED1);
+Data_IMU * foo;
+Data_IMU * bar;
+
+int main()
+{
+
+ i.setOffset();
+ foo = i.getOffset();
+ bar = i.getData();
+
+ while(1) {
+
+ myled = 1; // LED is ON
+ wait(0.2); // 200 ms
+ myled = 0; // LED is OFF
+ wait(10);
+
+ i.refresh(1);
+
+
+ pc.printf("OFFSET : \r\n");
+ pc.printf("Temperature:\t\t %f C\r\n", foo->TEMPERATURE_Value_C);
+ pc.printf("Humidity:\t\t %f%%\r\n", foo->HUMIDITY_Value);
+ pc.printf("Pressure:\t\t %f hPa\r\n", foo->PRESSURE_Value);
+ pc.printf("Magnetometer (mGauss):\t X: %d, Y: %d, Z: %d\r\n", foo->MAG_Value->AXIS_X, foo->MAG_Value->AXIS_Y, foo->MAG_Value->AXIS_Z);
+ pc.printf("Accelerometer (mg):\t X: %d, Y: %d, Z: %d\r\n", foo->ACC_Value->AXIS_X, foo->ACC_Value->AXIS_Y, foo->ACC_Value->AXIS_Z);
+ pc.printf("Gyroscope (mdps):\t X: %d, Y: %d, Z: %d\r\n", foo->GYR_Value->AXIS_X, foo->GYR_Value->AXIS_Y, foo->GYR_Value->AXIS_Z);
+ pc.printf("\r\n");
+
+ pc.printf("OFFSET DATA : \r\n");
+ pc.printf("Temperature:\t\t %f C\r\n", bar->TEMPERATURE_Value_C);
+ pc.printf("Humidity:\t\t %f%%\r\n", bar->HUMIDITY_Value);
+ pc.printf("Pressure:\t\t %f hPa\r\n", bar->PRESSURE_Value);
+ pc.printf("Magnetometer (mGauss):\t X: %d, Y: %d, Z: %d\r\n", bar->MAG_Value->AXIS_X, bar->MAG_Value->AXIS_Y, bar->MAG_Value->AXIS_Z);
+ pc.printf("Accelerometer (mg):\t X: %d, Y: %d, Z: %d\r\n", bar->ACC_Value->AXIS_X, bar->ACC_Value->AXIS_Y, bar->ACC_Value->AXIS_Z);
+ pc.printf("Gyroscope (mdps):\t X: %d, Y: %d, Z: %d\r\n", bar->GYR_Value->AXIS_X, bar->GYR_Value->AXIS_Y, bar->GYR_Value->AXIS_Z);
+ pc.printf("\r\n");
+
+
+ }
}
+
+
Robotique FIP