esp8266 wifi access point does not accept more than 1 client
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- arduino, cpp
- Ambito
- embedded-iot, networking
Direzione di ricerca
Inizia dalla configurazione di WiFi.softAP e dalla gestione di UDP nello sketch. Traccia come vengono aggiornati remoteIp e remoteUDPPort quando arrivano i pacchetti e come vengono inviati i dati in uscita dopo un input seriale. Esegui i test con client A01 e B01 e considera il comportamento completo quando le informazioni provenienti da entrambi i client vengono ricevute e gestite simultaneamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi, I am using ESP8266 as my Access point and want to receive information from 2 remote arduino devices simultaneously. I am just able to get the information from one of those remote arduinos. My code at the access point is given as under:
`#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include <TimeLib.h>
//These are the avariables you can change for your project. For example, change the SSID (network ID), change the ports on both machines.
//The most useful one is the LOOP_DELAY which changes how quicly it refreshes. set to 100ms be default.
char ssid[] = "ESPAP"; // your network SSID (name)
char password[] = "mPass@54321"; //Set the AP's password
unsigned int localPort = 2390; // local port to listen on
#define LOOP_DELAY 10 //how fast we check for new data
#define ARRAYSIZE 255 //size of message array (255bytes)
#define BAUD_RATE 115200 //serial comunication speed
//global variables
IPAddress remoteIp;
int remoteUDPPort;
char packetBuffer[ARRAYSIZE]; //buffer to hold incoming packet
int arraySize = ARRAYSIZE;
char inData[ARRAYSIZE]; // Allocate some space for the string
char inChar; // Where to store the character read
byte aindex = 0; // Index into array; where to store the character
boolean dataToSend = false;
WiFiUDP Udp;
void setup()
{
Serial.begin(BAUD_RATE);
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password); //Start AP
// IPAddress myIP = WiFi.softAPIP(); if ever in doubt on this devices IP address you can get it here. Should be 192.168.4.1
Udp.begin(localPort);
WiFi.setSleepMode(WIFI_NONE_SLEEP);
}
void loop() {
while(Serial.available() > 0) //check for something to read from serial port
{
if(aindex < (arraySize-1)) // One less than the size of the array
{
inChar = Serial.read(); // Read a character
inData[aindex] = inChar; // Store it
aindex++; // Increment where to write next
inData[aindex] = '\0'; // Null terminate the string
}
dataToSend = true;
}
//check for incoming data via UDP
int packetSize = Udp.parsePacket();
if (packetSize)
{
remoteIp = Udp.remoteIP();
remoteUDPPort = Udp.remotePort();
int len = Udp.read(packetBuffer, 255); //read in the packet
if (len > 0)
{
packetBuffer[len] = 0;
}
Serial.println(packetBuffer);
}
// send UDP Data - this sends data to the last device it receives data from. For a one to one link this is fine. If there are multiple clients then this may need to be adjusted to store and send to all clients.
if(dataToSend)
{
if(Udp.beginPacket(remoteIp, remoteUDPPort))
{
Udp.write(inData);
Udp.endPacket();
//Serial.println(inData); //Uncomment this line for a local echo of the data sent
}
else
{
Serial.println("No connection");
}
dataToSend = false; //set the flag to false, ie only send when you need to.
for (aindex=0; aindex < arraySize; aindex++) //wipe the array
{
inData[aindex] = '\0'; // Null terminate the string
}
aindex = 0; //reset the index
}
}`
The information sent by remote devices are preceded by an identifier A01, B01. The information received from one remote device is :
B01 23.00 2384 916.35 5.14 0.000 5.00 -23.00
B01 23.00 2412 916.35 5.14 0.000 5.00 -23.00
B01 23.00 2466 916.35 5.15 0.000 5.00 -23.00
whereas i do not receive from A01. Kindly suggest. Many thanks
- Lingua principale
- Makefile
- Stelle
- 278
- Fork
- 125
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di esp8266/source-code-examples
-
nnect Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
-
ji Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 1/100
-
ch Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 1/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
Tutte le issue di esp8266/source-code-examples
Issue simili
-
approved checks-failed
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
zwave-js/firmware-updates#390 · 1 commento ·
-
OTA is not aborted correctly Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
espressif/esp-aws-iot#261 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
zephyrproject-rtos/zephyr#120011 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DiamondLightSource/dodal#2211 ·
-
CVA6 cache increase Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100