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
Revision 9:0b6c84d01c5d, committed 2013-11-30
- Comitter:
- lonczy
- Date:
- Sat Nov 30 18:35:04 2013 +0000
- Parent:
- 8:84597c4309a9
- Child:
- 10:2c506aad93de
- Commit message:
- added play/pouse support in the middle of the slider.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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); }