This example positions a lit LED in the I2C LED array using the rotary encoder

Dependencies:   mbed

Revision:
0:498b9b4a7bb9
diff -r 000000000000 -r 498b9b4a7bb9 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 02 08:27:23 2010 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "RotaryEncode.h"
+#include "PCA9532.h"
+
+RotaryEncode RE(p16,p17);
+PCA9532 leds (p28,p27,0xc0);
+
+int main() {
+
+    int position = 0;
+
+    while(1) {
+ 
+       int offset = RE.read();
+       
+       if ((offset > 0) && (position < 15)) {
+           position++;
+       }
+       else if ((offset < 0) && (position > 0)) {
+           position--;
+       }
+       
+       leds.write(0x1 << position);       
+       wait (0.2);
+              
+    }
+}
+
+