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@30:425970eb469b, 2020-09-08 (annotated)
- Committer:
- cauvinf
- Date:
- Tue Sep 08 14:49:19 2020 +0000
- Revision:
- 30:425970eb469b
- Parent:
- 29:64501815055f
- Child:
- 31:f5fbe3be117d
version 2 : avec SW2 et SW3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cauvinf | 25:df8141dc98b3 | 1 | #include "mbed.h" // Ajout de la librairie "mbed.h" |
dan | 0:7dec7e9ac085 | 2 | |
cauvinf | 30:425970eb469b | 3 | DigitalOut Led_verte(LED2); |
cauvinf | 30:425970eb469b | 4 | DigitalOut Led_rouge(LED1); |
cauvinf | 28:ee8094c22b43 | 5 | DigitalIn BP2(PTC6); |
cauvinf | 30:425970eb469b | 6 | DigitalIn BP3(PTA4); |
dan | 0:7dec7e9ac085 | 7 | |
cauvinf | 27:994c549bf33e | 8 | int main() { // fonction principale |
cauvinf | 27:994c549bf33e | 9 | while(1) { // boucle pendant 1 |
cauvinf | 28:ee8094c22b43 | 10 | if (BP2 == 1) // si le BP2 est appuyé |
cauvinf | 28:ee8094c22b43 | 11 | { |
cauvinf | 30:425970eb469b | 12 | Led_verte = 1; // on eteint la led bleue |
cauvinf | 28:ee8094c22b43 | 13 | } |
cauvinf | 28:ee8094c22b43 | 14 | else // else |
cauvinf | 28:ee8094c22b43 | 15 | { |
cauvinf | 30:425970eb469b | 16 | Led_verte = 0; // on allume la led bleue |
cauvinf | 30:425970eb469b | 17 | } |
cauvinf | 30:425970eb469b | 18 | if (BP3 == 1) // si le BP2 est appuyé |
cauvinf | 30:425970eb469b | 19 | { |
cauvinf | 30:425970eb469b | 20 | Led_rouge = 1; // on eteint la led bleue |
cauvinf | 30:425970eb469b | 21 | } |
cauvinf | 30:425970eb469b | 22 | else // else |
cauvinf | 30:425970eb469b | 23 | { |
cauvinf | 30:425970eb469b | 24 | Led_rouge = 0; // on allume la led bleue |
cauvinf | 28:ee8094c22b43 | 25 | } |
cauvinf | 28:ee8094c22b43 | 26 | |
cauvinf | 28:ee8094c22b43 | 27 | } // fin boucle infinie |
cauvinf | 29:64501815055f | 28 | } // fin programme. |