L'équipe robotique FIP a pour but de participer à la Coupe de France de Robotique (http://www.planete-sciences.org/robot/?section=pages&pageid=79). L'équipe est composée d'étudiants de l'école d'ingénieur Télécom Bretagne en filière par partenariat. Nous utilisons comme plateforme les microcontrôleurs STM32 associés aux cartes NUCLEO.
Dependencies: mbed HC_SR04_Ultrasonic_Library Nucleo_Sensor_Shield VL6180x_lib
Fork of Coupe Robotique FIP by
We are a team of students building an autonomous robot which will compete in the French Robotic Cup.
main.cpp@4:149c4509b35d, 2015-04-02 (annotated)
- Committer:
- julientiron
- Date:
- Thu Apr 02 22:18:06 2015 +0000
- Revision:
- 4:149c4509b35d
- Parent:
- 2:32226f1d12e5
- Child:
- 11:fce59d46840f
- Child:
- 14:4f85e35de719
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
julientiron | 0:72eb2b48a9e4 | 1 | #include "mbed.h" |
julientiron | 2:32226f1d12e5 | 2 | #include "ultrasonic.h" |
julientiron | 2:32226f1d12e5 | 3 | |
julientiron | 2:32226f1d12e5 | 4 | void dist(int distance) |
julientiron | 2:32226f1d12e5 | 5 | { |
julientiron | 4:149c4509b35d | 6 | //code exécuté lorsque la distance change |
julientiron | 2:32226f1d12e5 | 7 | printf("Distance changed to %dmm\r\n", distance); |
julientiron | 2:32226f1d12e5 | 8 | } |
julientiron | 2:32226f1d12e5 | 9 | |
julientiron | 4:149c4509b35d | 10 | ultrasonic mu(D8, D9, .1, 1, &dist); //Trigger: pin D8; Echo: pin D9 |
julientiron | 4:149c4509b35d | 11 | //Updates toutes les 0.1 secondes et timeout après 1 seconde |
julientiron | 4:149c4509b35d | 12 | //Appel de dist lorsque la distance change |
julientiron | 2:32226f1d12e5 | 13 | |
julientiron | 2:32226f1d12e5 | 14 | int main() |
julientiron | 2:32226f1d12e5 | 15 | { |
julientiron | 4:149c4509b35d | 16 | mu.startUpdates();//démarre la mesure |
julientiron | 2:32226f1d12e5 | 17 | while(1) |
julientiron | 2:32226f1d12e5 | 18 | { |
julientiron | 2:32226f1d12e5 | 19 | //Do something else here |
julientiron | 2:32226f1d12e5 | 20 | mu.checkDistance(); //call checkDistance() as much as possible, as this is where |
julientiron | 2:32226f1d12e5 | 21 | //the class checks if dist needs to be called. |
julientiron | 2:32226f1d12e5 | 22 | } |
julientiron | 2:32226f1d12e5 | 23 | } |