Please help me with this error, i am unable to understand this. #9296
Unanswered
M-Rizwan-Anwar
asked this question in
Q&A
Replies: 1 comment
-
From the posted code, I guess that this is built using Arduino as Component, right? This seems based on the example found in https://github.com/espressif/arduino-esp32/blob/master/libraries/AsyncUDP/examples/AsyncUDPClient/AsyncUDPClient.ino Make sure that you are using the same WiFi configurations found in the Arduino Core sdkconfig.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using "AsyncUDP" library to connect to server and the example I am using is "AsyncUDPServer" but I cannot connect to wifi. I am getting this in my terminal, can anyone help?
Code:
#include <Arduino.h>
#include <WiFi.h>
#include "AsyncUDP.h"
extern "C"
{
#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
}
extern "C"
{
void app_main(void);
}
const char * ssid = "Redminote12";
const char * password = "12345678#";
AsyncUDP udp;
void app_main(void)
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("WiFi Failed");
while(1) {
delay(1000);
}
}
if(udp.connect(IPAddress(192,168,1,100), 1234)) {
Serial.println("UDP connected");
udp.onPacket([](AsyncUDPPacket packet) {
Serial.print("UDP Packet Type: ");
Serial.print(packet.isBroadcast()?"Broadcast":packet.isMulticast()?"Multicast":"Unicast");
Serial.print(", From: ");
Serial.print(packet.remoteIP());
Serial.print(":");
Serial.print(packet.remotePort());
Serial.print(", To: ");
Serial.print(packet.localIP());
Serial.print(":");
Serial.print(packet.localPort());
Serial.print(", Length: ");
Serial.print(packet.length());
Serial.print(", Data: ");
Serial.write(packet.data(), packet.length());
Serial.println();
//reply to the client
packet.printf("Got %u bytes of data", packet.length());
});
//Send unicast
udp.print("Hello Server!");
}
while(1)
{
/* code */
delay(1000);
//Send broadcast on port 1234
udp.broadcastTo("Anyone here?", 1234);
}}
Terminal Output:
[1B][0;32mI (611) wifi_init: WiFi IRAM OP enabled[1B][0m
[1B][0;32mI (616) wifi_init: WiFi RX IRAM OP enabled[1B][0m
[ 79][E][WiFiGeneric.cpp:696] wifiLowLevelInit(): esp_wifi_init 4353
W (638) wifi:wifi osi_nvs_open fail ret=4353
[1B][0;32mI (638) wifi_init: rx ba win: 6[1B][0m
[1B][0;32mI (639) wifi_init: tcpip mbox: 32[1B][0m
[1B][0;32mI (639) wifi_init: udp mbox: 6[1B][0m
[1B][0;32mI (643) wifi_init: tcp mbox: 6[1B][0m
[1B][0;32mI (647) wifi_init: tcp tx win: 5744[1B][0m
[1B][0;32mI (651) wifi_init: tcp rx win: 5744[1B][0m
[1B][0;32mI (655) wifi_init: tcp mss: 1440[1B][0m
[1B][0;32mI (659) wifi_init: WiFi IRAM OP enabled[1B][0m
[1B][0;32mI (663) wifi_init: WiFi RX IRAM OP enabled[1B][0m
[ 127][E][WiFiGeneric.cpp:696] wifiLowLevelInit(): esp_wifi_init 4353
[ 144][E][WiFiSTA.cpp:252] begin(): STA enable failed!
WiFi Failed
Beta Was this translation helpful? Give feedback.
All reactions