Test

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Helmut64
Date:
Fri Feb 17 13:20:47 2017 +0000
Parent:
0:eef6d081aebe
Commit message:
Added more F103 support.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r eef6d081aebe -r 203c68bc3e88 main.cpp
--- a/main.cpp	Thu Feb 16 17:08:12 2017 +0000
+++ b/main.cpp	Fri Feb 17 13:20:47 2017 +0000
@@ -1,7 +1,15 @@
 #include "mbed.h"
 
-DigitalOut myled(LED1);
-//InterruptIn event(PA_10/*USER_BUTTON*/);
+#ifdef TARGET_NUCLEO_F103RB
+#define MY_LED      PC_13
+#define MY_BUTTON   NC
+#else
+#define MY_LED      LED1
+#define MY_BUTTON   USER_BUTTON
+#endif
+
+DigitalOut myled(MY_LED);
+
 
 volatile int updatedLED = 0;
 
@@ -13,14 +21,23 @@
 
 int main()
 {
-    //Serial ser(USBTX, USBRX);
-    //ser.baud(230400);
-    //event.fall(&ButtonPressed);
-    // event.mode(PullUp);
+    Serial ser(USBTX, USBRX);
+    ser.baud(230400);   
+
+    InterruptIn *event = NULL;
+    if (MY_BUTTON != NC) {
+        event = new InterruptIn(MY_BUTTON);
+        event->fall(&ButtonPressed);
+        // event.mode(PullUp);
+    }
+
     int intrnos = 0;
    
-    //ser.printf("Hello, World\r\n");
+    ser.printf("Hello, World\r\n");
+    ser.printf("SysClock: %u Hz.\r\n", SystemCoreClock);
+
     int i = 0;
+    
     for(;;) {
         while(i < 5) {
             myled = 1; // LED is ON
@@ -30,6 +47,8 @@
             i++;
         }
         sleep();
-        //ser.printf("Wakeup: %d LED: %d\r\n", ++intrnos, updatedLED);
+        ser.printf("Wakeup: %d Intr: %d\r\n", ++intrnos, updatedLED);
+        myled = !myled;
+        wait(0.1);
    }
 }
diff -r eef6d081aebe -r 203c68bc3e88 mbed.bld
--- a/mbed.bld	Thu Feb 16 17:08:12 2017 +0000
+++ b/mbed.bld	Fri Feb 17 13:20:47 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f
\ No newline at end of file