blinky for stm32f303

Dependencies:   mbed

Fork of mbed_blinky by mbed official

Files at this revision

API Documentation at this revision

Comitter:
RCMISbed
Date:
Sun Sep 30 16:55:30 2018 +0000
Parent:
0:3451e643c64c
Commit message:
mbed bliny stm32f303

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3451e643c64c -r 01bef667dbe8 main.cpp
--- a/main.cpp	Tue Feb 14 16:04:39 2017 +0000
+++ b/main.cpp	Sun Sep 30 16:55:30 2018 +0000
@@ -1,12 +1,34 @@
-#include "mbed.h"
-
-DigitalOut myled(LED1);
-
-int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
-    }
-}
+#include "mbed.h"
+
+#define TSample        0.001
+#define Periode        300
+#define onTime          10
+
+DigitalOut led(LED1);
+DigitalOut son(PA_7);
+
+int wdt = 0;
+char msg[] = "Salut artiste";
+Ticker TMainProcess;
+
+void MainProcess_Isr(void){
+    --wdt; 
+    if((wdt< onTime)& (wdt> 0)){led= 1;};
+    if(wdt<= 0){led= 0; wdt= Periode;};   
+    }
+
+void init(void){
+ //   son= 1;
+    TMainProcess.attach(&MainProcess_Isr, TSample); 
+    son= 0;
+    }
+
+
+// main() runs in its own thread in the OS
+int main(void) {
+    led= 0;
+    TMainProcess.attach(&MainProcess_Isr, TSample); 
+    while (true) {};
+    return 3;
+}
+