This is my first program on mbed.org. A Small program for KL25Z that'll act as a Volume Control, thanks to samux for his code with USB keyboard support (https://mbed.org/users/samux/code/USBKeyboard_HelloWorld/) Just added functionality to let the user use the Touch Slider on the KL25Z board to control system volume.

Dependencies:   mbed TSI MMA8451Q USBDevice

Fork of USBKeyboard_HelloWorld by Samuel Mokrani

Revision:
9:0b6c84d01c5d
Parent:
8:84597c4309a9
--- a/main.cpp	Sat Nov 30 14:49:17 2013 +0000
+++ b/main.cpp	Sat Nov 30 18:35:04 2013 +0000
@@ -56,10 +56,14 @@
                 ///this is basically for not letting the volume be changed in every .1 seconds, and keeping the code responsive
                 ///you could have a counter on every 10th reading or so.
                 current=newRead;
-                if (current<0.5)
+                if (current<0.4)
                     //if touched in the bottom half lower the volume
                     keyboard.mediaControl(KEY_VOLUME_DOWN);
                 else
+                    if (current<0.6)
+                        //if touched in the bottom half lower the volume
+                        keyboard.mediaControl(KEY_PLAY_PAUSE);
+                    else
                     //if touched in the top half rise the volume
                     keyboard.mediaControl(KEY_VOLUME_UP);
             }