Exemple d'initialisation variable (polymorphisme)

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //code dérivé du code présenté dans le document 2018-01 247-436 D-0015 M2-S4-TH (powerpoint)
00002 #include "mbed.h"
00003 #include "maClasseToggle.h"
00004 int main() {
00005 uint16_t retour;
00006 DigitalOut monLED(LED1);
00007 maClasseToggle monObjetToggle1;
00008 maClasseToggle monObjetToggle2(1);
00009   printf("initialisation\n");
00010   retour = monObjetToggle1.retourneStatut();
00011   printf("statut 1: %d\n", retour);
00012   retour = monObjetToggle2.retourneStatut();
00013   printf("statut 2: %d\n", retour);  
00014   while(1) {
00015     monObjetToggle1.toggle();
00016     retour = monObjetToggle1.retourneStatut();
00017     printf("statut 1: %d\n", retour);  
00018     monLED = retour;
00019     wait(1);
00020   }
00021 }