Comments (4)
Hi
Trying to neopixel code and the code does not work Can you tell me what's wrong or how I could change to make it work properly ?.
void loop() {
uint8_t i;
uint16_t packetSize = eUDP.parsePacket();
if ( packetSize ) {
packetSize = eUDP.read(packetBuffer, SACN_BUFFER_MAX);
uint8_t read_result = Universe0->readDMXPacketContents(eUDP, packetSize);
uint8_t read_result2 = 0;
if ( read_result == RESULT_DMX_RECEIVED ) {
// edge case test universe 1, slot 1
for (int p=0; p<8; p++) {
// for each NeoPixel find the slot number (each takes 3 slots for RGB)
i = 3*p;
// write to NeoPixel Driver
leds.setPixelColor(p, Universe0->getSlot(i+1), Universe0->getSlot(i+2), Universe0->getSlot(i+3));
}
// send to NeoPixel Ring
leds.show();
}
else if ( read_result == RESULT_NONE ) { // if not good dmx first universe (or art poll), try 2nd
read_result2 = Universe1->readDMXPacketContents(eUDP, packetSize);
if ( read_result2 == RESULT_DMX_RECEIVED ) {
// edge case test 2nd universe, slot 512
for (int p=8; p<16; p++) {
// for each NeoPixel find the slot number (each takes 3 slots for RGB)
i = 3*p;
// write to NeoPixel Driver
leds.setPixelColor(p, Universe1->getSlot(i+1), Universe1->getSlot(i+2), Universe1->getSlot(i+3));
}
// send to NeoPixel Ring
leds.show();
}
}
}
}
from lxdmxethernet_library.
As noted in the commit for the 2 Universe example, it is untested. Try the example with leds connected to pins 9 and 10 to see if the problem is with your NeoPixel code.
from lxdmxethernet_library.
Yes with for example LED code works properly, not works only for neopixel code.
The code works in the following terms but it works very slowly, the problem will packetSize because the same code works correctly in library LXWiFiArtNet.
void loop() {
uint16_t r,g,b;
uint8_t i;
// read a packet and if the packet is dmx, write its data to the pixels
if ( Universe0->readDMXPacket(eUDP) ) {
for (int p=0; p<170; p++) {
// for each NeoPixel find the slot number (each takes 3 slots for RGB)
i = 3p;
r = Universe0->getSlot(i+1); // Red
g = Universe0->getSlot(i+2); // Green
b = Universe0->getSlot(i+3); // Blue
// gamma correct
r = (r_r)/255;
g = (g_g)/255;
b = (b_b)/255;
// write to NeoPixel Driver
ring.setPixelColor(p, r, g, b);
}
// send to NeoPixel Ring
ring.show();
}
if ( Universe1->readDMXPacket(eUDP) ) {
for (int p=170; p<340; p++) {
// for each NeoPixel find the slot number (each takes 3 slots for RGB)
i = 3_p;
r = Universe1->getSlot(i+1); // Red
g = Universe1->getSlot(i+2); // Green
b = Universe1->getSlot(i+3); // Blue
// gamma correct
r = (r_r)/255;
g = (g_g)/255;
b = (bb)/255;
// write to NeoPixel Driver
ring.setPixelColor(p, r, g, b);
}
// send to NeoPixel Ring
ring.show();
}
}
from lxdmxethernet_library.
It is possible you have a pin conflict with one of the select lines for the ethernet shield. The two universe example is updated with a working NeoPixel test.
from lxdmxethernet_library.
Related Issues (6)
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 lxdmxethernet_library.