Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 10 months ago.
USBKeyboard Why I can't printf more than 5 brackets?
Very simple code:
- include "mbed.h"
- include "USBKeyboard.h"
USBKeyboard keyboard;
int main(void) {
while (1) {
keyboard.printf("[[[[[");
wait(2);
keyboard.printf("#
");
wait(2);
}
}
I had to use # because when I send the string "]]]]]]]]]" it will actually just print "@@@@@"
But it will only print ] five times, even if I send the string "#
#
##" it will only print the first five ] and then a bunch of @ even after the code loops.
I have to reset the mbed for it to print another five ] and then it goes back to @
I am on a MacBook Pro Retina with TouchBar
Would love any help.
1 Answer
7 years, 10 months ago.
Hello, I solved that on windows with this steps
go to USBDevice/USBHID/USBKeyboard.cpp and define US_KEYBOARD,
then change your PC input language to ENG(United States) US keyboard
I hope this solve your problem, if not, we will have to see the keymap for macbook pro
Thank you for the quick help!
I am using a Japanese computer. Could this library or API output Japanese keys as well? I'm actually just trying to use photoshop shortcuts. Would you happen to know how to send Function keys like F5 and so? In mac you have to press Fn key before.
posted by 29 Dec 2016As I read, Fn key has not a code to send to PC. All the changes are made before send, maybe we could send the code for the actions you want. In other words you will have normal F keys (F1,F2...) and other line of F modified keys. There are already codes for F keys in the keymap, did You tried them?
posted by 29 Dec 2016