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
Diff: main.cpp
- Revision:
- 0:82242c25009e
- Child:
- 1:3624dcc1851d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Aug 27 20:25:43 2020 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+DigitalOut Led_rouge(PTB22);
+Ticker horloge; // creation de l'objet "horloge" de type "Ticker"
+InterruptIn KBI_SW2(SW2); // création de l'objet KBI_SW2 associé à l'interruption
+InterruptIn KBI_SW3(SW3); // création de l'objet KBI_SW3 associé à l'interruption
+
+void IT_horloge() // écriture du sous programme d'interruption associé au Ticker
+{
+Led_rouge=!Led_rouge; // la led rouge change d'état
+}
+void IT_SW2() // ecriture du sous programme appui SW2
+{
+horloge.attach(&IT_horloge,0.1); // on lance le IT lors d'un appui sur SW2
+}
+void IT_SW3() // ecriture du sous programme appui SW3
+{
+horloge.detach(); // on arrete les IT lors d'un appui sur SW3
+Led_rouge=1; // on éteint la led rouge
+}
+
+int main ()
+{
+ Led_rouge=1; // on éteint la led rouge
+ KBI_SW2.fall(&IT_SW2); // le programme IT_SW2 est attaché a l'appui sur SW2
+ KBI_SW3.fall(&IT_SW3); // le programme IT_SW3 est attaché a l'appui sur SW3
+ while(1)
+ {
+ }
+}
\ No newline at end of file