Hi,
The Seeduino Micro https://www.amazon.com/gp/product/B081SZHJVS/ (also known as the Femto M0) has a SAMD21G18 and so should work with keyboard emulation, right?
“SAMD micro based boards” <LINK_TEXT text=“https://www.arduino.cc/reference/en/lan … /keyboard/”>https://www.arduino.cc/reference/en/language/functions/usb/keyboard/</LINK_TEXT>
Does anyone have ideas on why the following code fails?
The Flash process completes, but the serial port (attached via usb) does not respond (no serial.print) and there is no new keyboard attached to the usb…
It works when tested with a Leonardo… (the serial usb reads and then the usb keyboard emulator repeats…)
[code]#include “Keyboard.h”
char incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // open the serial port at 9600 bps:
}
void loop() {
Keyboard.begin();
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte);
Keyboard.write(incomingByte);
Keyboard.end();
}
}[/code]
Thanks,
F