test

Dependencies:   USBDevice mbed

Committer:
USER10
Date:
Thu Nov 16 00:22:02 2017 +0000
Revision:
0:53a565ce0cf6
HID

Who changed what in which revision?

UserRevisionLine numberNew contents of line
USER10 0:53a565ce0cf6 1 #include "mbed.h"
USER10 0:53a565ce0cf6 2 #include "USBKeyboard.h"
USER10 0:53a565ce0cf6 3
USER10 0:53a565ce0cf6 4 Serial pc2(p13, p14);//tx1, rx1
USER10 0:53a565ce0cf6 5
USER10 0:53a565ce0cf6 6 //LED1: NUM_LOCK
USER10 0:53a565ce0cf6 7 //LED2: CAPS_LOCK
USER10 0:53a565ce0cf6 8 //LED3: SCROLL_LOCK
USER10 0:53a565ce0cf6 9 BusOut leds(LED1, LED2, LED3);
USER10 0:53a565ce0cf6 10
USER10 0:53a565ce0cf6 11 //USBKeyboard
USER10 0:53a565ce0cf6 12 USBKeyboard keyboard;
USER10 0:53a565ce0cf6 13
USER10 0:53a565ce0cf6 14 int main(void) {
USER10 0:53a565ce0cf6 15 char ch;
USER10 0:53a565ce0cf6 16 while (1) {
USER10 0:53a565ce0cf6 17 if(pc2.readable()) { // 受信確認
USER10 0:53a565ce0cf6 18 ch = pc2.getc(); // 1文字取り出し
USER10 0:53a565ce0cf6 19 keyboard.printf("%c\r\n", ch);
USER10 0:53a565ce0cf6 20 wait(1);
USER10 0:53a565ce0cf6 21 leds = keyboard.lockStatus();
USER10 0:53a565ce0cf6 22 }
USER10 0:53a565ce0cf6 23 }
USER10 0:53a565ce0cf6 24 }