hay man I understand your confusion. let me explain it.
so the Leonardo can act as a USB keyboard and mouse but the Leonardo I guess, from what I tested and read, that it can not type to the Nintendo switch, something about not being a bootkeyboard or what ever. I don't understand it ether.
you would thing that a Arduino board that can act as a HID keyboard would work on a Nintendo switch, but it dose not and I don't know why.
The Leonardo presents as a USB keyboard.
What plugs into the Nintendo Switch? A USB keyboard (or mouse)?
Probably a Nintendo-only device (like Apple stuff, no "3rd party" allowed).
1 Like
you can plug a USB keyboard to the Nintendo switch and have it work, but the Leonardo dose not.
I don't remember where I read it, but some ware I came across a forum that suggested bootkeyboard to let the Leonardo type to the Nintendo switch but when I tried it it kina word but not all the way. it only got some of the key strokes instead of all of them. that is why I posed here to see if anyone knows of a Arduino/3rd party HID boards that works fully with the Nintendo switch as a reprogrammable keyboard.
Using keyboard.h, the Leonardo presents as, simulates, a USB keyboard.
https://www.arduino.cc/reference/en/language/functions/usb/keyboard/
I could be wrong, but it seems that if you program your Leonardo with this
#include <Keyboard.h>
void setup()
{
Keyboard.begin();
}
and plug it into the Nintendo Switch then it should be satisfied that a keyboard is there.
Keyboard - Arduino Reference
Note: Not every possible ASCII character, particularly the non-printing ones, can be sent with the Keyboard library.
this is my code i've tryed on my leonardo.
#include <Keyboard.h>
const int pinLed = LED_BUILTIN;
int BT_Baud = 19200;
//SoftwareSerial BT(10, 11); // RX, TX
char Incoming_value = 0;
void setup() {
Serial.begin(19200);
Serial1.begin(19200);
pinMode(pinLed, OUTPUT);
// Sends a clean report to the host. This is important on any Arduino type.
Keyboard.begin();
Keyboard.releaseAll();
}
void loop() {
digitalWrite(pinLed, LOW);
if(Serial1.available() > 0){
Incoming_value = Serial1.read();
if(Incoming_value == '\n'){
Keyboard.write(Incoming_value);
}else{
digitalWrite(pinLed, HIGH);
Keyboard.write(Incoming_value);
}
}
}//test:
if it is my code then can you tell me what i mite be doing wrong?
the Keyboard.h library is the default one.
@runaway_pancake do you have both a Nintendo switch and a Leonardo?
Is the Keyboard.write supposed to repeat what is received on Serial1?
yes serial1 is connected to the HC-05 Bluetooth part.
Give me an example of what is sent from the smartphone, what is to be received at the Leonardo.
so when i plug the leonardo to the switch the rx light is on.
That's fine, I guess.
But I want to know what key, or combination of keys, is the N.Switch supposed to see to be 'happy' with. Which key triggers the 'Fire' button or whatever.
What data is sent from the smartphone?
with bootkeyboard its random keys that gets displayed as keyboard presses
with keyboard its none.
in case you didn't read.
when I plug my board to the switch the RX led turns on. I think the switch is trying to initialize a hand shack but the board dose not know what to do with what's coming in.
Me?
Here's the question for a Third Time -
what's an example of the data that you are sending from the smartphone ?
i am sending letters, numbers, and charters like @ and # nothing that isn't on a keyboard.
There is nothing in your sketch that interprets the data received from bluetooth into a corresponding keyboard code.
I don't have anything boxed, wrapped and bowed for you. If the smartphone sends B, then the sketch has to read that and come up with the equivalent of clicking B on the keyboard -
Keyboard.write('B');
void loop()
{
if(Serial1.available() > 0)
{
Incoming_value = Serial1.read();
Keyboard.write(Incoming_value);
}
}
its suppose to receive one char at a time from my phone over Bluetooth and spit it out to serial1 (the rx and tx ports on the board) the Leonardo is suppose to read the serial1 data and store it in the variable Incoming_value and then its suppose to test if the variable = '\n' or not and write (Keyboard.write()) the char in the variable.