10char *
const udpServer
PROGMEM =
"192.168.0.102";
11char *
const udpServer2
PROGMEM =
"192.168.0.255";
14uint16_t
const udpPort
PROGMEM = 5000;
15uint16_t
const udpPort2
PROGMEM = 7000;
22SC16IS750
i2cuart = SC16IS750(SC16IS750_PROTOCOL_I2C,SC16IS750_ADDRESS_AA);
65char*
const errTxt[]
PROGMEM = {
"No error, everything OK.",
"Out of memory.",
"Unknown code.",
"Timeout.",
"Routing problem.",
"Operation in progress.",
66 "Unknown code.",
"Total number exceeds the maximum limitation.",
"Connection aborted.",
"Connection reset.",
"Connection closed.",
67 "Not connected.",
"Illegal argument.",
"Unknown code.",
"UDP send error.",
"Already connected."};
69 commError = commError*-1;
70 if (commError <= 15) {
71 return (
char *) pgm_read_word (&errTxt[commError]);
73 return (
char *) pgm_read_word (&errTxt[2]);
81void udpCb(uint8_t resp_type, uint8_t client_num, uint16_t len,
char *data) {
82 Serial.println(
"udpCb is called");
85 Serial.println(
"\tSent " + String(len) +
" bytes over connection #" + String(client_num));
88 memcpy(recvData, data, len);
91 Serial.println(
"\tReceived " + String(len) +
" bytes over client#" + String(client_num));
92 Serial.println(
"\tReceived: " + String(recvData));
94 Serial.println(
"Received invalid response type");
97 Serial.print(F(
"Send error: "));
106 if (res->
argc() == 1) {
111 Serial.println(F(
"WIFI CONNECTED"));
114 Serial.print(F(
"WIFI NOT READY: "));
124 Serial.println(F(
"EL-Client starting!"));
133 if (!ok)
Serial.println(F(
"EL-Client sync failed!"));
135 Serial.println(F(
"EL-Client synced!"));
141 if ((packet=
esp.WaitReturn()) != NULL) {
142 Serial.print(F(
"Wifi status: "));
150 Serial.print(F(
"UDP begin failed: "));
153 asm volatile (
" jmp 0");
158 Serial.print(F(
"UDP2 begin failed: "));
161 asm volatile (
" jmp 0");
164 Serial.println(F(
"EL-Client ready!"));
165 wait = millis()+29000;
174 if (millis() -
wait > 30000) {
177 Serial.print(F(
"Sending message to "));
178 Serial.println(udpServer);
179 udp.send(
"Message from your Arduino Uno WiFi over UDP socket");
182 Serial.print(F(
"Sending broadcast to "));
183 Serial.println(udpServer2);
184 udp2.send(
"Broadcast from your Arduino Uno WiFi over UDP socket");
189 Serial.println(F(
"Lost connection, try to reboot"));
191 asm volatile (
" jmp 0");
Definitions for ELClientSocket.
Definitions for ELClient.
int16_t popArg(void *data, uint16_t maxLen)
Extract an argument from the response packet.
void wifiCb(void *response)
char * getErrTxt(int16_t commError)
char *const udpServer PROGMEM
void udpCb(uint8_t resp_type, uint8_t client_num, uint16_t len, char *data)