ajout de l'imu pour nucleo

Dependencies:   mbed HC_SR04_Ultrasonic_Library IMU_FIP_nucleo Nucleo_Sensor_Shield VL6180x_lib

Files at this revision

API Documentation at this revision

Comitter:
julientiron
Date:
Tue Mar 31 13:51:26 2015 +0000
Parent:
1:c6105db4ad17
Child:
3:5f6a98846df7
Child:
7:dc76d89a8d51
Commit message:
d?tection distance;

Changed in this revision

HC_SR04_Ultrasonic_Library.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HC_SR04_Ultrasonic_Library.lib	Tue Mar 31 13:51:26 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/ejteb/code/HC_SR04_Ultrasonic_Library/#e0f9c9fb4cf3
--- a/main.cpp	Tue Mar 31 13:47:34 2015 +0000
+++ b/main.cpp	Tue Mar 31 13:51:26 2015 +0000
@@ -1,5 +1,23 @@
 #include "mbed.h"
-// main du robot
-int main(){
-    
-}
\ No newline at end of file
+#include "ultrasonic.h"
+
+ void dist(int distance)
+{
+    //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);    //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();//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.
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 31 13:51:26 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file