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.
Fork of mbed-os-example-mbed5-blinky by
Diff: main.cpp
- Revision:
- 77:d67966bc6494
- Parent:
- 76:0d9524062816
diff -r 0d9524062816 -r d67966bc6494 main.cpp
--- a/main.cpp Thu Aug 30 08:39:36 2018 +0000
+++ b/main.cpp Thu Aug 30 10:53:51 2018 +0000
@@ -1,17 +1,31 @@
#include "mbed.h"
+#define TSample 0.001
+#define Periode 700
+#define onTime 10
+
DigitalOut led(LED4);
DigitalOut son(p8);
+int wdt = 0;
+
+Ticker TMainProcess;
+
+void MainProcess_Isr(){
+ --wdt;
+ if((wdt< onTime)& (wdt> 0)){led= 1;};
+ if(wdt<= 0){led= 0; wdt= Periode;};
+ }
+
+void init(void){
+ son= 0;
+ TMainProcess.attach(&MainProcess_Isr, TSample);
+ }
+
// main() runs in its own thread in the OS
-int main() {
- son= 0;
- while (true) {
- led = 1;
- wait(0.05);
- led = 0;
- wait(0.9);
- }
+void main() {
+ init();
+ while (true) {};
}
