breadboard
Example project · Board-to-board radio

Uno R4 · Wi-Fi access point and HTTP peer

The left board runs the official AP_SimpleWebServer and creates testAP. After its ten-second startup, the right board joins over WPA2 and sends HTTP requests that switch the server’s D13 LED. Edit the client’s requests in Code; inspect the AP’s address and connected station on the left board.

The Uno R4 · Wi-Fi access point and HTTP peer 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

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.

// 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);
}

Firmware licence

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.

Related projects