Bitmanipulation mit Stick

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
haunsi
Date:
Mon Dec 16 18:30:19 2019 +0000
Parent:
1:d2cce2700a45
Commit message:
Interrupt_Spielereien

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Dec 16 18:22:18 2019 +0000
+++ b/main.cpp	Mon Dec 16 18:30:19 2019 +0000
@@ -17,7 +17,12 @@
  
 void shiftled() 
 {       
-    leds = leds | leds << 1;
+    leds = leds << 1;
+    leds = leds | 0b0010; 
+    if ( leds == 0b1111)
+    {
+        leds = leds ^ 0b1111;
+    }
 }
  
 void turn_led2_on()