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@0:82242c25009e, 2020-08-27 (annotated)
- Committer:
- snec_student
- Date:
- Thu Aug 27 20:25:43 2020 +0000
- Revision:
- 0:82242c25009e
- Child:
- 1:3624dcc1851d
version kbi;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| snec_student | 0:82242c25009e | 1 | #include "mbed.h" |
| snec_student | 0:82242c25009e | 2 | DigitalOut Led_rouge(PTB22); |
| snec_student | 0:82242c25009e | 3 | Ticker horloge; // creation de l'objet "horloge" de type "Ticker" |
| snec_student | 0:82242c25009e | 4 | InterruptIn KBI_SW2(SW2); // création de l'objet KBI_SW2 associé à l'interruption |
| snec_student | 0:82242c25009e | 5 | InterruptIn KBI_SW3(SW3); // création de l'objet KBI_SW3 associé à l'interruption |
| snec_student | 0:82242c25009e | 6 | |
| snec_student | 0:82242c25009e | 7 | void IT_horloge() // écriture du sous programme d'interruption associé au Ticker |
| snec_student | 0:82242c25009e | 8 | { |
| snec_student | 0:82242c25009e | 9 | Led_rouge=!Led_rouge; // la led rouge change d'état |
| snec_student | 0:82242c25009e | 10 | } |
| snec_student | 0:82242c25009e | 11 | void IT_SW2() // ecriture du sous programme appui SW2 |
| snec_student | 0:82242c25009e | 12 | { |
| snec_student | 0:82242c25009e | 13 | horloge.attach(&IT_horloge,0.1); // on lance le IT lors d'un appui sur SW2 |
| snec_student | 0:82242c25009e | 14 | } |
| snec_student | 0:82242c25009e | 15 | void IT_SW3() // ecriture du sous programme appui SW3 |
| snec_student | 0:82242c25009e | 16 | { |
| snec_student | 0:82242c25009e | 17 | horloge.detach(); // on arrete les IT lors d'un appui sur SW3 |
| snec_student | 0:82242c25009e | 18 | Led_rouge=1; // on éteint la led rouge |
| snec_student | 0:82242c25009e | 19 | } |
| snec_student | 0:82242c25009e | 20 | |
| snec_student | 0:82242c25009e | 21 | int main () |
| snec_student | 0:82242c25009e | 22 | { |
| snec_student | 0:82242c25009e | 23 | Led_rouge=1; // on éteint la led rouge |
| snec_student | 0:82242c25009e | 24 | KBI_SW2.fall(&IT_SW2); // le programme IT_SW2 est attaché a l'appui sur SW2 |
| snec_student | 0:82242c25009e | 25 | KBI_SW3.fall(&IT_SW3); // le programme IT_SW3 est attaché a l'appui sur SW3 |
| snec_student | 0:82242c25009e | 26 | while(1) |
| snec_student | 0:82242c25009e | 27 | { |
| snec_student | 0:82242c25009e | 28 | } |
| snec_student | 0:82242c25009e | 29 | } |