Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"udp send" methods does not work my esp8266 #93

Open
masaokubo opened this issue Jun 23, 2017 · 2 comments
Open

"udp send" methods does not work my esp8266 #93

masaokubo opened this issue Jun 23, 2017 · 2 comments

Comments

@masaokubo
Copy link

I use Arduino uno r3 with esp8266 firm 0018000902.
I have tried UDP packet from this uno to its sever on another pc by "send" method in ITEADLIB_Arduino_WeeESP8266.
However it output no packets.
Could you give me any suggestions.

thank you for your support.

@masaokubo
Copy link
Author

My code is described as follows.
JoinAP, registerUDP is ok but this does not send any packets.

thank you for your supports.


#include "ESP8266.h"

#define SSID "XXXXX"
#define PASSWORD "XXXXX"
#define HOST_NAME "XXXX"
#define HOST_PORT (YYYY)

SoftwareSerial mySerial(11, 12); /* RX:D12, TX:D11 */
ESP8266 wifi(mySerial);
void setup(void)
{
Serial.begin(9600);
Serial.print("setup begin\r\n");

Serial.print("FW Version:");
Serial.println(wifi.getVersion().c_str());
  
if (wifi.setOprToStationSoftAP()) {
    Serial.print("to station + softap ok\r\n");
} else {
    Serial.print("to station + softap err\r\n");
}

if (wifi.joinAP(SSID, PASSWORD)) {
    Serial.print("Join AP success\r\n");
    Serial.print("IP: ");
    Serial.println(wifi.getLocalIP().c_str()); 
         
} else {
    Serial.print("Join AP failure\r\n");
}

if (wifi.disableMUX()) {
    Serial.print("single ok\r\n");
} else {
    Serial.print("single err\r\n");
}

Serial.print("setup end\r\n");

}
void loop(void)
{
uint8_t buffer[128] = {0};

if (wifi.registerUDP(HOST_NAME, HOST_PORT)) {
Serial.print("register udp ok\r\n");
} else {
Serial.print("register udp err\r\n");
}

char msgxx[256];
sprintf(msgxx,"Hello, this is client!\r\n");
wifi.send((const uint8_t*)msgxx, strlen(msgxx));
Serial.println(msgxx);

if (wifi.unregisterUDP()) {
    Serial.print("unregister udp ok\r\n");
} else {
    Serial.print("unregister udp err\r\n");
}


delay(5000);

}

@vicjomaa
Copy link

Hello I`ve the same problem using Arduino Uno R3, indeed the console show me this messages when i probe your code.
unregister udp err
register udp err

could you fix the problem ?
thanks for all...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants