Skip to content

Instantly share code, notes, and snippets.

View T-vK's full-sized avatar

T-vK

View GitHub Profile
@T-vK
T-vK / WledRealtimeClient.mjs
Last active March 14, 2024 23:52
Example showing how to use the WLED realtime UDP interface with Node.js
import dgram from 'dgram';
class WledRealtimeClient {
constructor(wledControllerIp, numPixels, udpPort = 21324, maxPixelsPerPacket = 126) {
this.wledControllerIp = wledControllerIp;
this.numPixels = numPixels;
this.udpPort = udpPort;
this.maxPixelsPerPacket = maxPixelsPerPacket;
this.sock = dgram.createSocket('udp4');
this.prevPixels = Buffer.alloc(3 * this.numPixels, 253);
@T-vK
T-vK / test
Created December 11, 2019 12:14
Test
test