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, 6 months ago.
Can any of the NUCLEO boards be set up as HID Keyboard AND Mouse
Hi all, I want to make a few prototype units for a new project. I have looked in Farnell and the NUCLEO-F042K6 is less than £9 So no real issue with that.
But Ideally I want it to be a USB Keyboard AND Mouse, Or a basic HID,
Can any of theses boards (the long thin form factor ones) do the above ??
Cheers
Ceri.
Requirements:
My requirements are 6 PWM's 6 ADC's
A couple of buttons & LED's.
Maybe, 10 NEO-PIXEL'S
Question relating to:
1 Answer
7 years, 6 months ago.
Hello Ceri,
The NUCLEO-F042K6 board shall be OK. Have a look at Norimasa Okamoto's site https://os.mbed.com/users/va009039/code/F042K6_USBDevice/ for more details. However, you can give also the low cost STM32F103C8T6 or the Maple Mini boards a try. For testing, load the STM32F103C8T6_USBSerial or MapleMini_USBSerial demo into the online compiler and modify the code according to the USBMouseKeyboard demo (see below).
#include "stm32f103c8t6.h"
#include "mbed.h"
//#include "USBSerial.h"
#include "USBMouseKeyboard.h"
int main() {
confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock)
Serial pc(PA_2, PA_3);
DigitalOut myled(LED1);
//USBSerial usbSerial; // connection is blocked when USB is not plugged in
//USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false);// connection is not blocked when USB is not plugged in
USBMouseKeyboard key_mouse;
while (1) {
//myled = !myled;
//pc.printf("I am a serial port\r\n"); // 9600 bit/s
//usbSerial.printf("I am a USB serial port\r\n"); // 12 Mbit/s (USB full-speed)
//wait_ms(1000);
key_mouse.mediaControl(KEY_VOLUME_DOWN);
key_mouse.printf("Hello World from Mbed\r\n");
key_mouse.keyCode('s', KEY_CTRL);
key_mouse.move(20, 0);
key_mouse.keyCode(KEY_SCROLL_LOCK);
wait(1);
myled = key_mouse.lockStatus();
}
}
Remember to select the NUCLEO-F103RB platform as target for the online compiler.
It worked for me fine.