breadboard
documentación

Proyecto de ejemplo · Radio entre placas

Uno R4 · Punto de acceso y cliente HTTP

La placa izquierda ejecuta AP_SimpleWebServer oficial y crea testAP. Tras su arranque de diez segundos, la derecha se conecta por WPA2 y envía solicitudes HTTP que conmutan D13 del servidor. Edita las solicitudes del cliente en Code; inspecciona dirección y estación conectada en la placa izquierda.

El circuito Uno R4 · Punto de acceso y cliente HTTP tal como lo dibuja el simulador

Componentes del montaje

  • 2× Arduino Uno R4

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.

// SPDX-License-Identifier: MIT
// First-party peer for the unchanged official AP_SimpleWebServer fixture.
#include <WiFiS3.h>
void setup() {
  Serial.begin(9600);
  if (WiFi.begin("testAP", "123456789") != WL_CONNECTED) {
    Serial.println("peer association failed");
    while (true) delay(1000);
  }
  delay(11000); // Official server waits ten seconds before listening.
}
void loop() {
  static bool high = true;
  WiFiClient client;
  if (!client.connect(IPAddress(192,48,56,2), 80)) {
    Serial.println("peer connection failed");
    delay(1000);
    return;
  }
  client.print(high ? "GET /H HTTP/1.0\r\n" : "GET /L HTTP/1.0\r\n");
  client.print("Host: r4-peer\r\n\r\n");
  unsigned long start = millis();
  while ((client.connected() || client.available()) && millis() - start < 3000) {
    while (client.available()) Serial.write(client.read());
  }
  client.stop();
  Serial.println(high ? "peer done H" : "peer done L");
  high = !high;
  delay(2000);
}

Licencia del firmware (en inglés)

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

arduino-unor4wifi-wifi-ap-server.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.

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

arduino-unor4wifi-wifi-ap-client.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