Yves Roy
/
247-436-M2-S4-TH-B
Exemple d'initialisation variable (polymorphisme)
Diff: main.cpp
- Revision:
- 0:1e0b34f02f01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 14 15:22:56 2018 +0000 @@ -0,0 +1,21 @@ +//code dérivé du code présenté dans le document 2018-01 247-436 D-0015 M2-S4-TH (powerpoint) +#include "mbed.h" +#include "maClasseToggle.h" +int main() { +uint16_t retour; +DigitalOut monLED(LED1); +maClasseToggle monObjetToggle1; +maClasseToggle monObjetToggle2(1); + printf("initialisation\n"); + retour = monObjetToggle1.retourneStatut(); + printf("statut 1: %d\n", retour); + retour = monObjetToggle2.retourneStatut(); + printf("statut 2: %d\n", retour); + while(1) { + monObjetToggle1.toggle(); + retour = monObjetToggle1.retourneStatut(); + printf("statut 1: %d\n", retour); + monLED = retour; + wait(1); + } +}