Wired up both, and got the powering part working. I have an LCD connected to each boar, and that's working fine.
(Both boards are interconnected using USB C to USB C breakout boards.)
However, I can't seem to get them to talk to each other.
On the sender side, I trigger the following code when I press a button, and I can see that the LED is switched on.
Code: Select all
Serial.write(1);
digitalWrite(LED, HIGH);
Code: Select all
if (Serial.available() > 0) {
digitalWrite(LED, HIGH);
char number = Serial.read();
}
I have tested putting the LED logic outside the if statement to check that everything is wired correctly, and it is.
The boards have their 5V and GND pins connected to each other and the RX of one board to the TX of the other board and vice versa.
-------------------------------
I have the following hypothesis, based on things I read online, but unsure if it's correct;
RX/TX pins are even used for the USB serial connection between the PC and the board connected to it, and RX/TX can therefore not be used for what I'm trying to do?
Some boards seem to have additional serial ports on other pins, and in those cases you would use Serial1, Serial2, etc?
Is this correct? Is it impossible to use the RX/TX pins for other stuff if you're powering the board through USB?
If so, how do I get around the problem?
I don't need to be able to use the use the serial port monitor, I can debug using the LCDs I have connected to each board.
The boards will act as an HID (split) keyboard.