USBKeyboard Hello World

Dependencies:   mbed USBDevice

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "USBKeyboard.h"
00003  
00004 //LED1: NUM_LOCK
00005 //LED2: CAPS_LOCK
00006 //LED3: SCROLL_LOCK
00007 BusOut leds(LED1, LED2, LED3);
00008  
00009 //USBKeyboard
00010 USBKeyboard keyboard;
00011  
00012 int main(void) {
00013     while (1) {
00014         keyboard.mediaControl(KEY_VOLUME_DOWN);
00015         keyboard.printf("Hello World from Mbed\r\n");
00016         keyboard.keyCode('s', KEY_CTRL);
00017         keyboard.keyCode(KEY_CAPS_LOCK);
00018         wait(1);
00019         leds = keyboard.lockStatus();
00020     }
00021 }