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@31:f5fbe3be117d, 2020-09-08 (annotated)
- Committer:
- cauvinf
- Date:
- Tue Sep 08 15:04:22 2020 +0000
- Revision:
- 31:f5fbe3be117d
- Parent:
- 30:425970eb469b
version 3 -GPIO avec grove
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 | 31:f5fbe3be117d | 3 | DigitalOut Led_verte(D2); |
cauvinf | 30:425970eb469b | 4 | DigitalOut Led_rouge(LED1); |
cauvinf | 31:f5fbe3be117d | 5 | DigitalIn BP2(D3); |
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 | 28:ee8094c22b43 | 18 | } // fin boucle infinie |
cauvinf | 29:64501815055f | 19 | } // fin programme. |