I am using the following code:
#include "USBHostGiga.h"
//REDIRECT_STDOUT_TO(Serial)
Keyboard keyb;
HostSerial ser;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial);
pinMode(PA_15, OUTPUT);
keyb.begin();
ser.begin();
}
void loop() {
if (keyb.available()) {
auto _key = keyb.read();
Serial.println(keyb.getAscii(_key));
}
while (ser.available()) {
auto _char = ser.read();
Serial.write(_char);
}
//delay(1);
}
from here: https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-usb
I am using Arduino GIGA R1 on which I have connected a USB keyboard and I press buttons. I see the results on the Serial. However, I face the following problem: When I press a button, apart of the letter I get also a square next to it. For instance, let's say I press the 'A' letter. In the serial I get 'A' letter + a square symbol. When I press 'B', I get 'B' + a square symbol, etc. I am trying for 2 days to fix it, I tried to read the button as a char array with two positions and delete the [1] where the square should be, but nothing worked. The auto type is very strange in order to make a type casting, because the Arduino IDE continuously shows me error. I cannot find a way to remove the strange 'square' ASCII character which I take with each letter pressed...The only things I noticed is that the square ASCII character is displayed the time I release the keyboard button, and also it delays to appear when I increase the delay ms in the delay(...); command. Has anyone any idea how to solve this?
Serial.println(_key, HEX)look like?