breadboard
documentação

Projeto de exemplo · Rádio entre placas

Ponto de acesso Wi-Fi com Uno R4

A placa da esquerda roda o AP_SimpleWebServer oficial e cria a rede testAP. Depois da inicialização de dez segundos, a placa da direita entra na rede por WPA2 e envia requisições HTTP que acendem e apagam o LED em D13 do servidor. Edite as requisições do cliente em Code; confira o endereço do AP e a estação conectada na placa da esquerda.

O circuito Ponto de acesso Wi-Fi com Uno R4 desenhado pelo simulador

O que está na bancada

  • 2× Arduino Uno R4

O código

Este sketch Arduino C++ fica em “Code”. Entre na sua conta e clique em “Compile & upload” para compilar firmware real para a 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);
}

Licença do firmware (em 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 um problema na tradução

Projetos relacionados