ajout de l'imu pour nucleo
Dependencies: mbed HC_SR04_Ultrasonic_Library IMU_FIP_nucleo Nucleo_Sensor_Shield VL6180x_lib
main.cpp
- Committer:
- julientiron
- Date:
- 2015-04-02
- Revision:
- 4:149c4509b35d
- Parent:
- 2:32226f1d12e5
- Child:
- 11:fce59d46840f
- Child:
- 14:4f85e35de719
File content as of revision 4:149c4509b35d:
#include "mbed.h" #include "ultrasonic.h" void dist(int distance) { //code exécuté lorsque la distance change 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 int main() { mu.startUpdates();//démarre la mesure 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. } }