Repetidor Wifi com ESP32
Enviado: 27/Jul/2018, 16:48
Boa tarde
Será que pode ajudar a construir um repetidor wifi com esp32
Obrigado
Será que pode ajudar a construir um repetidor wifi com esp32
Obrigado
Fórum sobre dúvidas com relação ao conteúdo disponibilizado pelo Fernando Koyanagi
http://www.forum.fernandok.com/
Código: Selecionar todos
#define IP_FORWARD 1
#include <WiFi.h>
#include <WiFiUDP.h>
const char *ssid = "Control Seguidores Plus";
const char *password = "12345678";
IPAddress apIP(128, 0, 15, 1);
const char* ssidExt = "Control Seguidores";
const char* passwordExt = "12345678";
const byte DNS_PORT = 53;
// A UDP instance to let us send and receive packets over UDP
WiFiUDP Udp;
byte packetBuffer[512]; //buffer to hold incoming and outgoing packets
WiFiUDP Udp8;
// Update these with values suitable for your network.
IPAddress ip(192, 168, 15, 1); //Node static IP
IPAddress gateway(128, 0, 0, 1);
IPAddress subnet(255, 255, 0, 0);
void setup()
{
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_AP_STA);
//WiFi.mode(WIFI_AP);
WiFi.begin(ssidExt, passwordExt);
WiFi.config(ip, gateway, subnet);
//Wifi connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Udp.begin(DNS_PORT);
Udp8.begin(DNS_PORT);
}
void loop()
{
int noBytes = Udp.parsePacket();
if ( noBytes )
{
Udp.read(packetBuffer, noBytes); // read the packet into the buffer
IPAddress ip8(8, 8, 8, 8);
Udp8.beginPacket(ip8, DNS_PORT); //NTP requests are to port 123
Udp8.write(packetBuffer, noBytes);
Udp8.endPacket();
delay(100);
int cb = Udp8.parsePacket();
if (cb) {
byte packetBuffer8[cb];
Udp8.read(packetBuffer8, cb);
Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
Udp.write(packetBuffer8, cb);
Udp.endPacket();
}
}
}
já configurou os ip's?// Update these with values suitable for your network.
IPAddress ip(192, 168, 15, 1); //Node static IP
IPAddress gateway(128, 0, 0, 1);
IPAddress subnet(255, 255, 0, 0);