Simple example of using a rotary encoder to drive an RGB LED. At first, you can control the brightness of the red LED. Push the encoder shaft in and you can then control green. Push again to control blue. Then it repeats.

Dependencies:   mRotaryEncoder mbed

Revision:
1:126964580159
Parent:
0:3e6a4dfbcb88
--- a/main.cpp	Thu Dec 29 06:01:32 2016 +0000
+++ b/main.cpp	Thu Dec 29 19:49:50 2016 +0000
@@ -66,5 +66,9 @@
     enc.attachROTCW(cw);
     enc.attachROTCCW(ccw);
     enc.attachSW(btn);
+    // set fast period
+    redled.period(0.01);
+    greenled.period(0.01);
+    blueled.period(0.01);
     while (true);   // nothing else to do but wait
 }
\ No newline at end of file