Test

Fork of Nucleo-mbed-os-example-blinky by Helmut Tschemernjak

Files at this revision

API Documentation at this revision

Comitter:
Helmut64
Date:
Tue Jan 17 20:31:53 2017 +0000
Parent:
3:a6caeb32839c
Child:
5:7db87ff5ed38
Commit message:
Backup

Changed in this revision

BufferedSerial.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/BufferedSerial.lib	Sun Aug 21 19:25:29 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/sam_grove/code/BufferedSerial/#a0d37088b405
--- a/main.cpp	Sun Aug 21 19:25:29 2016 +0000
+++ b/main.cpp	Tue Jan 17 20:31:53 2017 +0000
@@ -1,18 +1,26 @@
 #include "mbed.h"
 
-#include "FATFileSystem.h"
+DigitalOut myled(LED1);
+InterruptIn event(USER_BUTTON);
+
+bool pressed = false;
 
-
-PwmOut led(LED1);
+void KeyPressed()
+{
+    pressed = true;
+}
 
-int main()
-{   
-    FATFileSystem *f;
-    
-    while (true) {
-        led = led + 0.05f;
-        wait(0.1);
-        if (led >= 1.0f)
-            led = 0;
+int main() {
+    event.fall(&KeyPressed);
+
+    while(1) {
+        myled = 1; // LED is ON
+        wait(0.2); // 200 ms
+        myled = 0; // LED is OFF
+        wait(1.0); // 1 sec
+        if (pressed) {
+            deepsleep();
+            pressed = false;
+        }
     }
 }
--- a/mbed-os.lib	Sun Aug 21 19:25:29 2016 +0000
+++ b/mbed-os.lib	Tue Jan 17 20:31:53 2017 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#0993ae540c5c4b5ce3004bead1aefc0c6d1b3ea0
+https://github.com/ARMmbed/mbed-os/#34c1facf42a174f47fdf9002cd8c6bf10ac41744