Giter Site home page Giter Site logo

2 Universe example about lxdmxethernet_library HOT 4 CLOSED

folny avatar folny commented on July 18, 2024
2 Universe example

from lxdmxethernet_library.

Comments (4)

folny avatar folny commented on July 18, 2024

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.

claudeheintz avatar claudeheintz commented on July 18, 2024

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.

folny avatar folny commented on July 18, 2024

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 = (b
b)/255;
// write to NeoPixel Driver
ring.setPixelColor(p, r, g, b);
}
// send to NeoPixel Ring
ring.show();
}
}

from lxdmxethernet_library.

claudeheintz avatar claudeheintz commented on July 18, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.