Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:4b492a32c76b
- Parent:
- 1:f9120f998887
diff -r f9120f998887 -r 4b492a32c76b main.cpp
--- a/main.cpp Thu Nov 03 17:38:03 2011 +0000
+++ b/main.cpp Fri Mar 01 13:24:33 2013 +0000
@@ -1,35 +1,33 @@
-#include "mbed.h"
-#include "USBKeyboard.h"
-
-USBKeyboard keyboard;
-
-//Bus of buttons
-BusInOut buttons(p21, p22, p23, p24, p25, p26, p29);
-
-int main(void) {
- uint8_t p_bus = 0;
-
- while (1) {
- //if the bus of buttons has changed, send a report
- if (buttons.read() != p_bus) {
- p_bus = buttons.read();
- if(p_bus & 0x01)
- keyboard.mediaControl(KEY_MUTE);
- if(p_bus & 0x02)
- keyboard.mediaControl(KEY_VOLUME_DOWN);
- if(p_bus & 0x04)
- keyboard.mediaControl(KEY_VOLUME_UP);
- if(p_bus & 0x08)
- keyboard.mediaControl(KEY_NEXT_TRACK);
- if(p_bus & 0x10)
- keyboard.mediaControl(KEY_PLAY_PAUSE);
- if(p_bus & 0x20)
- keyboard.mediaControl(KEY_PREVIOUS_TRACK);
- if(p_bus & 0x40)
- keyboard.printf("Hello World\r\n");
- }
- wait(0.01);
- }
-}
-
-
+#include "mbed.h"
+#include "USBKeyboard.h"
+
+USBKeyboard keyboard;
+
+//Bus of buttons
+BusInOut buttons(p21, p22, p23, p24, p25, p26, p29);
+
+int main(void) {
+ uint8_t p_bus = 0;
+
+ while (1) {
+ //if the bus of buttons has changed, send a report
+ if (buttons.read() != p_bus) {
+ p_bus = buttons.read();
+ if(p_bus & 0x01)
+ keyboard.mediaControl(KEY_MUTE);
+ if(p_bus & 0x02)
+ keyboard.mediaControl(KEY_VOLUME_DOWN);
+ if(p_bus & 0x04)
+ keyboard.mediaControl(KEY_VOLUME_UP);
+ if(p_bus & 0x08)
+ keyboard.mediaControl(KEY_NEXT_TRACK);
+ if(p_bus & 0x10)
+ keyboard.mediaControl(KEY_PLAY_PAUSE);
+ if(p_bus & 0x20)
+ keyboard.mediaControl(KEY_PREVIOUS_TRACK);
+ if(p_bus & 0x40)
+ keyboard.printf("Hello World\r\n");
+ }
+ wait(0.01);
+ }
+}
\ No newline at end of file