void setup() {
// reset WiFi module
wifi.println("AT+RST");
// 500ms delay followed by reading the result
wifi.println("AT+CWMODE=1");
// 500ms delay followed by reading the result
wifi.println("AT+CWJAP=\"accesspoint\",\"password\"");
// 500ms delay followed by reading the result
wifi.println("AT+CIPSTART=\"UDP\",\"10.0.1.100\",\"34807\"");
// 500ms delay followed by reading the result
}
void loop() {
int v;
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
rs232.print("Sending beacon: ");
char *data = "Beacon,10.0.1.57,8080";
int bytes = strlen(data);
wifi.print("AT+CIPSEND=");
wifi.println(bytes);
wifi.println(data);
wifi.println("AT+CIPCLOSE");
}
while(wifi.available() > 0) {
v = Serial.read();
if (v == 10) {
wb[wctr] = 0;
wctr = 0;
rs232.println(wb);
} else if (v == 13) {
// gndn
} else {
wb[wctr] = v;
wctr++;
}
}
}
And here's what I get back:
AT+CIPSEND=23
> MyBeacon,10.0.1.57,8080AT+CIPCLOSE
busy s...
busy s...
SEND OK
Nothing ever arrives at the destination. I've tested the server with code running on other systems and it works fine, so I'm guessing something is going wrong with my ESP-8266. Any suggestions or clues?
Thanks!