breadboard
Example project · Builds & projects

Uno R4 · physical Serial1 peers

Two boards exchange bytes over crossed D1 TX and D0 RX wires at 9600 baud, then 1 Mbaud. Select each board in Serial to read the received decimal values. Reset the simulation to repeat; edit the first board’s sketch in Code.

The Uno R4 · physical Serial1 peers circuit as rendered by the simulator

What's on the bench

  • 2× Arduino Uno R4
  • Battery

How it's wired

  • Battery · pos→Arduino Uno R4 · 5v
  • Battery · neg→Arduino Uno R4 · gnd
  • Battery · pos→Arduino Uno R4 · 5v
  • Battery · neg→Arduino Uno R4 · gnd
  • Arduino Uno R4 · d1→Arduino Uno R4 · d0
  • Arduino Uno R4 · d1→Arduino Uno R4 · d0

The code

This Arduino C++ sketch lives in the Code tab; sign in and press Compile & upload to build real firmware for the emulated board.

// Breadboard UNO R4 P5 solved-pin Serial1 acceptance fixture.

static void exchangeAt(uint32_t baud, const uint8_t *tx, size_t length) {
  Serial1.begin(baud);
  Serial1.write(tx, length);
  Serial1.flush();

  uint32_t started = millis();
  Serial.print(baud);
  while (millis() - started < 20) {
    if (Serial1.available()) {
      Serial.print(' ');
      Serial.print(Serial1.read());
    }
  }
  Serial.println();
  Serial1.end();
}

void setup() {
  Serial.begin(115200);
  static const uint8_t kSlow[] = {0x55, 0x00, 0xff};
  static const uint8_t kFast[] = {0xa5, 0x5a, 0x3c};
  exchangeAt(9600, kSlow, sizeof(kSlow));
  exchangeAt(1000000, kFast, sizeof(kFast));
}

void loop() {}

Firmware licence

Notice: this firmware uses the LGPL-licensed Arduino core library

arduino-unor4wifi-serial1.bin is statically linked with ArduinoCore-renesas 1.6.0, in Breadboard's port of its UNO R4 WiFi variant to Renesas FSP 5.3.0. Parts of that core are licensed under the GNU Lesser General Public License, version 2.1 or (at your option) any later version ("the Library"). Breadboard distributes this firmware under terms that permit you to modify the work for your own use and to reverse engineer it for debugging such modifications.

Related projects