coucou

Dependencies:   HC_SR04_Ultrasonic_Library mbed

Committer:
DELSAB
Date:
Wed Sep 28 14:25:21 2016 +0000
Revision:
1:3bad1115bf14
Parent:
0:5fba740a37eb
modif wait 0.2;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mathieusab 0:5fba740a37eb 1 #include "mbed.h"
mathieusab 0:5fba740a37eb 2 #include "ultrasonic.h"
mathieusab 0:5fba740a37eb 3
mathieusab 0:5fba740a37eb 4
mathieusab 0:5fba740a37eb 5 PinName trig = PA_10;
mathieusab 0:5fba740a37eb 6 PinName echo = PA_9;
mathieusab 0:5fba740a37eb 7 float updateSpeed = 1; // 1 Hz, 1 fois par sec
mathieusab 0:5fba740a37eb 8 float timeout = 2;
mathieusab 0:5fba740a37eb 9
mathieusab 0:5fba740a37eb 10
mathieusab 0:5fba740a37eb 11 int mesure = 0;
mathieusab 0:5fba740a37eb 12
mathieusab 0:5fba740a37eb 13 int main()
mathieusab 0:5fba740a37eb 14 {
mathieusab 0:5fba740a37eb 15
mathieusab 0:5fba740a37eb 16 ultrasonic(trig, echo, updateSpeed, timeout);
mathieusab 0:5fba740a37eb 17
mathieusab 0:5fba740a37eb 18 while(1)
mathieusab 0:5fba740a37eb 19 {
mathieusab 0:5fba740a37eb 20 mesure = getCurrentDistance();
mathieusab 0:5fba740a37eb 21 wait(0.1);
mathieusab 0:5fba740a37eb 22 printf("%d\n",mesure);
DELSAB 1:3bad1115bf14 23 wait(0.2);
mathieusab 0:5fba740a37eb 24 }
mathieusab 0:5fba740a37eb 25 }