mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-15 16:30:31 +02:00
add LED control example
command out all echos
This commit is contained in:
@ -30,26 +30,28 @@ void webSocketEvent(WStype_t type, uint8_t * payload, size_t lenght) {
|
||||
case WStype_CONNECTED:
|
||||
{
|
||||
USE_SERIAL.printf("[WSc] Connected to url: %s\n", payload);
|
||||
|
||||
// send message to server when Connected
|
||||
webSocket.sendTXT(num, "Connected");
|
||||
}
|
||||
break;
|
||||
case WStype_TEXT:
|
||||
USE_SERIAL.printf("[WSc] get text: %s\n", payload);
|
||||
|
||||
// send data to back to Server
|
||||
webSocket.sendTXT(payload, lenght);
|
||||
// send message to server
|
||||
// webSocket.sendTXT("message here");
|
||||
break;
|
||||
case WStype_BIN:
|
||||
USE_SERIAL.printf("[WSc] get binary lenght: %u\n", lenght);
|
||||
hexdump(payload, lenght);
|
||||
|
||||
// echo data back to Server
|
||||
webSocket.sendBIN(payload, lenght);
|
||||
// send data to server
|
||||
// webSocket.sendBIN(payload, lenght);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
// USE_SERIAL.begin(921600);
|
||||
USE_SERIAL.begin(115200);
|
||||
@ -79,8 +81,6 @@ void setup() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void loop() {
|
||||
webSocket.loop();
|
||||
}
|
||||
|
Reference in New Issue
Block a user