Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@3:c75f8eddeaf4, 2022-03-02 (annotated)
- Committer:
 - Giamarchi
 - Date:
 - Wed Mar 02 22:28:23 2022 +0000
 - Revision:
 - 3:c75f8eddeaf4
 - Parent:
 - 2:c1a4641eeacf
 - Child:
 - 4:610e1572bd1b
 
Station Meteo; Anemometre
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| Giamarchi | 2:c1a4641eeacf | 1 | //============================================================================== | 
| Giamarchi | 2:c1a4641eeacf | 2 | // FabLab Nîmes | 
| Giamarchi | 2:c1a4641eeacf | 3 | // Initiation à la Programmation | 
| Giamarchi | 2:c1a4641eeacf | 4 | // Auteur : Frédéric Giamarchi | 
| Giamarchi | 2:c1a4641eeacf | 5 | |
| Giamarchi | 3:c75f8eddeaf4 | 6 | // Date : 3 mars 2022 | 
| Giamarchi | 3:c75f8eddeaf4 | 7 | // TP : Anémomètre | 
| Giamarchi | 3:c75f8eddeaf4 | 8 | // Lecture optique par interruption | 
| Giamarchi | 2:c1a4641eeacf | 9 | // Utilisation de fonctions décrites dans un fichier séparé | 
| Giamarchi | 2:c1a4641eeacf | 10 | //============================================================================== | 
| Giamarchi | 2:c1a4641eeacf | 11 | // Déclarations des ressources | 
| Giamarchi | 0:531f33a2550d | 12 | #include "mbed.h" | 
| Giamarchi | 2:c1a4641eeacf | 13 | #include "fonctions.h" // Appel des fonctions du fichier : fonctions.h | 
| Giamarchi | 0:531f33a2550d | 14 | |
| Giamarchi | 2:c1a4641eeacf | 15 | //============================================================================== | 
| Giamarchi | 2:c1a4641eeacf | 16 | // Déclaration des broches | 
| Giamarchi | 2:c1a4641eeacf | 17 | DigitalOut DEL(PA_11); // Ligne PA_11 sur la carte Nucléo | 
| Giamarchi | 2:c1a4641eeacf | 18 | Serial pc(USBTX, USBRX); // Dialogue Série port USB à 9600 Baud | 
| Giamarchi | 2:c1a4641eeacf | 19 | |
| Giamarchi | 2:c1a4641eeacf | 20 | //============================================================================== | 
| Giamarchi | 2:c1a4641eeacf | 21 | // Déclaration des variables | 
| Giamarchi | 0:531f33a2550d | 22 | |
| Giamarchi | 2:c1a4641eeacf | 23 | char c; // variable de type caractère | 
| Giamarchi | 3:c75f8eddeaf4 | 24 | float temp; // variable de type réel | 
| Giamarchi | 3:c75f8eddeaf4 | 25 | int16_t vitesse; // variable de type 16 bits signée | 
| Giamarchi | 1:95172f59262a | 26 | |
| Giamarchi | 2:c1a4641eeacf | 27 | //============================================================================== | 
| Giamarchi | 2:c1a4641eeacf | 28 | // Début du Programme | 
| Giamarchi | 2:c1a4641eeacf | 29 | int main() // Fonction principale | 
| Giamarchi | 0:531f33a2550d | 30 | { | 
| Giamarchi | 2:c1a4641eeacf | 31 | Init_Fonctions(); // Exécute cette fonction | 
| Giamarchi | 3:c75f8eddeaf4 | 32 | pc.printf("\r\nFabLab TP Anemometre\r\n\n"); | 
| Giamarchi | 3:c75f8eddeaf4 | 33 | |
| Giamarchi | 2:c1a4641eeacf | 34 | //============================================================================== | 
| Giamarchi | 2:c1a4641eeacf | 35 | // Boucle Infinie | 
| Giamarchi | 0:531f33a2550d | 36 | while(1) | 
| Giamarchi | 0:531f33a2550d | 37 | { | 
| Giamarchi | 3:c75f8eddeaf4 | 38 | vitesse = Anemometre(); | 
| Giamarchi | 1:95172f59262a | 39 | |
| Giamarchi | 3:c75f8eddeaf4 | 40 | if(vitesse != -1) // Lecture disponible | 
| Giamarchi | 3:c75f8eddeaf4 | 41 | { | 
| Giamarchi | 3:c75f8eddeaf4 | 42 | pc.printf("Vit Vent : %d\n",vitesse); // Affichage sur Putty | 
| Giamarchi | 3:c75f8eddeaf4 | 43 | } | 
| Giamarchi | 1:95172f59262a | 44 | } // Fin du while(1) | 
| Giamarchi | 2:c1a4641eeacf | 45 | //============================================================================== | 
| Giamarchi | 2:c1a4641eeacf | 46 | } // Fin du Programme | 
| Giamarchi | 2:c1a4641eeacf | 47 | //============================================================================== |