Bus In Buttons

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
happy_alien
Date:
Mon Jan 13 17:18:37 2020 +0000
Commit message:
BusIn Buttons

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 000000000000 -r ec15682d6d01 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 13 17:18:37 2020 +0000
@@ -0,0 +1,97 @@
+#include "mbed.h"
+
+    //      D20,D19,D18,D17,
+BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);
+
+BusIn button(P0_10,P0_15,P0_23,P1_16);
+
+void Lauflicht();
+void shiftright();
+void Buttons();
+
+//AnologIn LDR(p16);
+int main()
+
+{   
+    
+    //Lauflicht();
+    //shiftright();
+    Buttons();
+  
+
+
+    
+    
+
+}
+void Lauflicht()
+{    while(1)
+{
+    lb=1;
+    for(int i=0;i<=11;i++)
+    {
+        wait_ms(200);
+        lb=lb<<1;
+    
+        lb=lb|1;
+        }
+    }
+    
+    }
+void shiftright()
+{
+    while(1)
+    {
+        lb=2048;
+        for(int i=0;i<=11;i++)
+        {   
+            wait_ms(200);
+            if(i<2)
+            {lb=(lb>>1)|2048;
+                
+            }
+            else
+            lb=lb>>1;
+            if(i=11)
+            {
+            }
+            
+            
+            }
+        }
+        
+        }
+void Buttons()
+{
+        lb=0;
+        while(1)
+        {
+        if(button & 1)
+        lb=lb|4;
+        if (button &2)
+        lb=lb|8;
+        if(button &4)
+        lb=lb|16;
+        if(button&8)
+        lb=lb|32;
+        
+        wait_ms(100);
+        lb=0;
+        wait_ms(100);
+        }
+        
+        
+        
+        
+        
+}
+        
+        
+        
+    
+    
+    
+    
+    
+
+
diff -r 000000000000 -r ec15682d6d01 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jan 13 17:18:37 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file