Programme à modifier dans le cours M2-S3-TH
main.cpp@1:18837547b3c9, 2018-02-07 (annotated)
- Committer:
- YROY2004
- Date:
- Wed Feb 07 08:12:57 2018 +0000
- Revision:
- 1:18837547b3c9
- Parent:
- 0:04fca093186e
Programme ? modifier en classe (solution du probl?me dans le document D-0013)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| YROY2004 | 0:04fca093186e | 1 | #include "mbed.h" |
| YROY2004 | 1:18837547b3c9 | 2 | //on vous demande de créer: |
| YROY2004 | 1:18837547b3c9 | 3 | //1) la classe maClasseLED |
| YROY2004 | 1:18837547b3c9 | 4 | //2) le constructeur de la classe |
| YROY2004 | 1:18837547b3c9 | 5 | //3) la méthode publique "toggle" pour |
| YROY2004 | 1:18837547b3c9 | 6 | // faire changer l'état de la DEL |
| YROY2004 | 1:18837547b3c9 | 7 | //4) une methode de type "getter" pour |
| YROY2004 | 1:18837547b3c9 | 8 | // récupérer l'état de la DEL |
| YROY2004 | 0:04fca093186e | 9 | DigitalOut myled(LED1); |
| YROY2004 | 0:04fca093186e | 10 | int main() { |
| YROY2004 | 1:18837547b3c9 | 11 | uint16_t statut; |
| YROY2004 | 1:18837547b3c9 | 12 | |
| YROY2004 | 1:18837547b3c9 | 13 | printf("initialisation\n"); |
| YROY2004 | 1:18837547b3c9 | 14 | |
| YROY2004 | 1:18837547b3c9 | 15 | while(1) { |
| YROY2004 | 1:18837547b3c9 | 16 | myled = !myled; |
| YROY2004 | 1:18837547b3c9 | 17 | |
| YROY2004 | 1:18837547b3c9 | 18 | statut = myled; |
| YROY2004 | 1:18837547b3c9 | 19 | printf("statut: %d\n", statut); |
| YROY2004 | 1:18837547b3c9 | 20 | wait(1); |
| YROY2004 | 0:04fca093186e | 21 | } |
| YROY2004 | 1:18837547b3c9 | 22 | } |