M0 Board LED Test

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
niclasesterl
Date:
Tue May 03 10:43:35 2016 +0000
Commit message:
M0 Board LED Test

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 03 10:43:35 2016 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+//Alle LEDs definiert
+DigitalOut ledD1(P1_8);
+DigitalOut ledD2(P1_9);
+DigitalOut ledD3(P1_10);
+DigitalOut ledD4(P1_11);
+DigitalOut ledD13(P1_0);
+DigitalOut ledD14(P1_1);
+DigitalOut ledD15(P1_3);
+DigitalOut ledD16(P1_4);
+DigitalOut ledD17(P1_6);
+DigitalOut ledD18(P1_7);
+DigitalOut ledD19(P1_12);
+DigitalOut ledD20(P1_13);
+
+//Alle Switches definiert
+DigitalIn  sw1(P0_10); //SW1
+DigitalIn  sw2(P0_15); //SW2 -> sein IO Pin ist laut Schaltplan der P0_15
+DigitalIn  sw3(P0_23); //SW3
+DigitalIn  sw4(P1_16); //SW4 
+int main(){
+    while(1){
+
+        ledD1 = ledD2 = ledD3 = 0;
+        ledD4 = ledD13 = ledD14 = 0;
+        ledD15 = ledD16 = ledD17 = 0;
+        ledD18 = ledD19 = ledD20 = 0;
+        if (sw2 == 1){
+            ledD1 = ledD2 = ledD3 = 1;
+        }
+        else if(sw1 == 1){
+            ledD4 = ledD13 = ledD14 = 1;
+        }
+        else if(sw3 == 1){
+            ledD15 = ledD16 = ledD17 = 1;
+        }
+        else if(sw4 == 1){
+            ledD18 = ledD19 = ledD20 = 1;
+        }
+    
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 03 10:43:35 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb
\ No newline at end of file