breadboard
documentación

Proyecto de ejemplo · Montajes y proyectos

Uno R4 · Comunicación física Serial1

Dos placas intercambian bytes por cables cruzados D1 TX y D0 RX a 9600 baudios y después 1 Mbaud. Selecciona cada placa en Serial para leer los valores decimales recibidos. Reinicia la simulación para repetir; edita el sketch de la primera en Code.

El circuito Uno R4 · Comunicación física Serial1 tal como lo dibuja el simulador

Componentes del montaje

  • 2× Arduino Uno R4

Cómo está conectado

  • Arduino Uno R4 · gnd2→Arduino Uno R4 · gnd
  • Arduino Uno R4 · d1→Arduino Uno R4 · d0
  • Arduino Uno R4 · d1→Arduino Uno R4 · d0

El código

Este sketch de Arduino C++ está en Code; inicia sesión y pulsa Compile & upload para compilar firmware real para la placa emulada.

// 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() {}

Licencia del firmware (en inglés)

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.

Informar de un problema de traducción

Proyectos relacionados