ajout de l'imu pour nucleo
Dependencies: mbed HC_SR04_Ultrasonic_Library IMU_FIP_nucleo Nucleo_Sensor_Shield VL6180x_lib
Revision 11:fce59d46840f, committed 2015-05-21
- Comitter:
- quentin9696
- Date:
- Thu May 21 11:17:08 2015 +0000
- Parent:
- 10:3eb49bd62e46
- Child:
- 12:921bbbfc6bcc
- Commit message:
- modif main
Changed in this revision
--- a/Capteurs/Capteurs_ultrasons.lib Thu May 21 11:05:10 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/users/ejteb/code/HC_SR04_Ultrasonic_Library/#e0f9c9fb4cf3
--- a/Capteurs/IMU_FIP.lib Thu May 21 11:05:10 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/users/quentin9696/code/IMU_FIP/#7e75dae22ddb
--- a/Capteurs/Nucleo_Sensor_Shield.lib Thu May 21 11:05:10 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/teams/ST-Americas-mbed-Team/code/Nucleo_Sensor_Shield/#57888ec40e75
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HC_SR04_Ultrasonic_Library.lib Thu May 21 11:17:08 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/ejteb/code/HC_SR04_Ultrasonic_Library/#e0f9c9fb4cf3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IMU_FIP.lib Thu May 21 11:17:08 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/Robotique-FIP/code/IMU_FIP/#89e327e1217f
--- a/Nucleo_BLE_BlueNRG.lib Thu May 21 11:05:10 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/teams/ST-Americas-mbed-Team/code/Nucleo_BLE_BlueNRG/#905715088a9b
--- a/main.cpp Thu May 21 11:05:10 2015 +0000
+++ b/main.cpp Thu May 21 11:17:08 2015 +0000
@@ -1,23 +1,72 @@
#include "mbed.h"
#include "ultrasonic.h"
+#include "Imu.h"
+/*
void dist(int distance)
{
- //code exécuté lorsque la distance change
+ //put code here to happen when the distance is changed
printf("Distance changed to %dmm\r\n", distance);
}
-ultrasonic mu(D8, D9, .1, 1, &dist); //Trigger: pin D8; Echo: pin D9
- //Updates toutes les 0.1 secondes et timeout après 1 seconde
- //Appel de dist lorsque la distance change
+ultrasonic mu(D8, D9, .1, 1, &dist); //Set the trigger pin to D8 and the echo pin to D9
+ //have updates every .1 seconds and a timeout after 1
+ //second, and call dist when the distance changes
int main()
{
- mu.startUpdates();//démarre la mesure
+ mu.startUpdates();//start mesuring the distance
while(1)
{
//Do something else here
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("RAW 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