Comments (4)
The example doesn't actually control the RGB LED, just a simple demo for WebSocket server.
To actually control the LEDs, you have to adapt the code from
to receive command ( in msg.data()
) and contriol the LEDs yourself
void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length)
{
switch(type)
{
case WStype_DISCONNECTED:
Serial.printf("[%u] Disconnected!\n", num);
break;
case WStype_CONNECTED:
{
IPAddress ip = webSocket.remoteIP(num);
Serial.printf("[%u] Connected from %d.%d.%d.%d url: %s\n", num, ip[0], ip[1], ip[2], ip[3], payload);
// send message to client
webSocket.sendTXT(num, "Connected");
}
break;
case WStype_TEXT:
Serial.printf("[%u] get Text: %s\n", num, payload);
if(payload[0] == '#')
{
// we get RGB data
// decode rgb data
uint32_t rgb = (uint32_t) strtol((const char *) &payload[1], NULL, 16);
analogWrite(LED_RED, ((rgb >> 16) & 0xFF));
analogWrite(LED_GREEN, ((rgb >> 8) & 0xFF));
analogWrite(LED_BLUE, ((rgb >> 0) & 0xFF));
}
break;
}
}
As I have no intention to do this, please use it as is or ignore the example
It maybe better to delete the example in the near future to avoid confusion.
Good Luck,
from websockets2_generic.
Do you have any working example of duplex socket communication using this library and a NANO RP2040 CONNECT? Everything I've tried does not work. The examples also seem to not work. The examples you linked to do not use this library, of which there are great differences in the implementation. I cannot find API documentation on this library (does that exist somewhere)?
Thus, kind of stuck; looking for some guidance as to how to get a duplex socket up and running with this library; with the server socket being hosted on the RP2040.
from websockets2_generic.
Try to switch to cheaper and faster RP2040W, using AsyncWebServer_RP2040W with arduino-pico core
from websockets2_generic.
Do you have any working example of duplex socket communication using this library and a NANO RP2040 CONNECT? Everything I've tried does not work. The examples also seem to not work. The examples you linked to do not use this library, of which there are great differences in the implementation. I cannot find API documentation on this library (does that exist somewhere)?
Thus, kind of stuck; looking for some guidance as to how to get a duplex socket up and running with this library; with the server socket being hosted on the RP2040.
I agree with @jnanneng2 , the code you are referring to seems to come from a different repo using a different library.
Can you share a full working example?
from websockets2_generic.
Related Issues (20)
- Compile error with Arduino Nano RP2040 HOT 2
- VSCode + PIO for Teensy4.1 compilation error. Complaining stm32_eth.h missing! HOT 1
- WebSockets2_generic library and MKR1000 + Ethernet Shield HOT 1
- CA Certificate not getting verified ? HOT 3
- QNEthernet higher latency HOT 10
- QNEthernet and NativeEthernet staticIP not working with WS Server HOT 19
- what is websocketclient if no incoming request? HOT 2
- ESP32-Server Not Working Properly HOT 2
- [Questions] How to receive binary data? HOT 1
- Connect() is blocking? HOT 1
- Error Compiling for board MKR WiFi 1010 HOT 1
- Error 1006 HOT 1
- WebSockets2_Generic example problem HOT 1
- Uploading and running example of ESP "Minimal-Esp32-Client" error [ 4159][E][WiFiClient.cpp:313] setSocketOption(): fail on -1, errno: 9, "Bad file number" HOT 3
- RP2040W-Server example does not compile without errors HOT 1
- Serious problem with timeout when sending packages HOT 1
- Portenta WiFi Websockets tested lately? HOT 5
- RP2040 WebSocket immediate disconnection HOT 2
- Multiple Clients Teensy41 server example QNEthernet HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websockets2_generic.