hey!
right now im trying to use the artnet4j lib in order to control an array of LEDs.
I will use 2 Universes each 500 LEDs. I want to send art-net to an enttec datagate mk2 device!
As far as I understood i cant get it work with the dmxp5 lib since it can only address one universe!??
First of all I was confused as I couldnt find an artnet4j.jar file in the lib directory when i downloaded the repository from
artnet4j ! I found a project from
toxiclibs where they used the artnet4j lib and I just took the artnet4j.jar file from its repository. I pasted the jar file into the library folder of the artnet4j repository and at the end I was able to import the artnet4j library into my processing sketch and it seems to do well!
Ive been rewriting the
PollTest.java code given in the artnet4j repository (see below) and i get the following message:
Jun 4, 2012 2:33:57 PM artnet4j.ArtNet <init>
INFO: Art-Net v0001-20091119
Jun 4, 2012 2:33:57 PM artnet4j.ArtNetServer start
INFO: Art-Net server started at port: 6454
Jun 4, 2012 2:33:57 PM artnet4j.ArtNetNodeDiscovery discoverNode
INFO: discovered new node: /2.7.93.177
Exception in thread "Thread-3" java.lang.NullPointerException
at artnet4j.ArtNetNodeDiscovery.discoverNode(Unknown Source)
at artnet4j.ArtNet$1.artNetPacketReceived(Unknown Source)
at artnet4j.ArtNetServer.run(Unknown Source)
at java.lang.Thread.run(Thread.java:680)
0 nodes found:
So apparently it finds my enttec device with correct ip but still says "0 nodes found".
When i println() my ArtNetNode openDMX it prints "null"!
Please help! Anyone with experience in using the artnet4j! or other methods to send artnet via ethernet!
Thank you very much for any hints and helpers since i am in a tight schedule!!!! as always!
dd
- import artnet4j.events.*;
- import artnet4j.packets.*;
- import artnet4j.*;
- ArtNetManager artnet;
- void setup(){
- artnet = new ArtNetManager();
- artnet.test();
- size(500,350);
- }
- void draw(){
- background(220);
- }
- class ArtNetManager implements ArtNetDiscoveryListener{
-
- ArtNetNode openDMX;
- int sequenceID=0;
-
- public void discoveredNewNode(ArtNetNode node) {
- if (openDMX == null) {
- openDMX = node;
- println("found openDMX");
- }
- println("New Nodes added: " + node.getIPAddress());
- }
-
- void discoveredNodeDisconnected(ArtNetNode node) {
- println("node disconnected: " + node);
- if (node == openDMX) {
- openDMX = null;
- }
- }
-
- void discoveryCompleted(List<ArtNetNode> nodes) {
- println(nodes.size() + " nodes found:");
- for (ArtNetNode n : nodes) {
- println(n);
- }
- }
-
- void discoveryFailed(Throwable t) {
- println("discovery failed");
- }
-
- void update(){
- }
-
- /** start artnet server and set buffer to light state */
-
- public void test(){
- ArtNet artnet = new ArtNet();
- try {
- artnet.start();
- ArtNetNodeDiscovery discovery = artnet.getNodeDiscovery();
- discovery.addListener(this);
- discovery.setInterval(6000);
- discovery.start();
- while (true) {
- //println(openDMX);
- if (openDMX != null) {
- ArtDmxPacket dmx = new ArtDmxPacket();
- dmx.setUniverse(openDMX.getSubNet(),
- openDMX.getDmxOuts()[0]);
- dmx.setSequenceID(sequenceID % 255);
- byte[] buffer = new byte[510];
- for (int i = 0; i < buffer.length; i++) {
- buffer[i] =
- (byte) (Math.sin(sequenceID * 0.05 + i * 0.8) * 127 + 128);
- }
- dmx.setDMX(buffer, buffer.length);
- artnet.unicastPacket(dmx, openDMX.getIPAddress());
- dmx.setUniverse(openDMX.getSubNet(),
- openDMX.getDmxOuts()[1]);
- artnet.unicastPacket(dmx, openDMX.getIPAddress());
- sequenceID++;
- }
- Thread.sleep(30);
- }
- } catch (SocketException e) {
- e.printStackTrace();
- } catch (ArtNetException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- }