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.
main.cpp
00001 #include "mbed.h" 00002 #include "USBKeyboard.h" 00003 00004 //LED1: NUM_LOCK, LED2: CAPS_LOCK, LED3: SCROLL_LOCK 00005 BusOut leds(LED1, LED2, LED3); 00006 DigitalOut button(P1_14); // Configure P1_14 pin as input 00007 USBKeyboard keyboard; 00008 00009 int main() { 00010 int buttonPressedCount = 0; 00011 00012 while (!keyboard.configured()) { // wait until keyboard is configured 00013 } 00014 00015 while (1) { 00016 leds = keyboard.lockStatus(); 00017 00018 if (button.read()) { 00019 buttonPressedCount++; 00020 if (2 == buttonPressedCount) { // when button is pressed about 0.02s 00021 keyboard.mediaControl(KEY_MUTE); // send mute key 00022 } 00023 } else { 00024 buttonPressedCount = 0; 00025 } 00026 wait(0.01); 00027 } 00028 }
Generated on Fri Jul 15 2022 17:06:09 by
