Go Down

Topic: Problemi libreria Artnet (Read 73 times) previous topic - next topic

Twing90

Ciao a tutti.
Ho trovato un progetto già pronto da modificare. Il progetto in oggetto vuol convertire il segnale Artnet per accendere una stripled.
Andando a scaricare il tutto mi imbatto in due problemi:
Il primo mi dice che la libreria Artnet.h non è installata e allora provvedo ad installarla attraverso il manager ma poi quando provo a compilare mi si presenta un altro errore.
Vi allego codice e il log del secondo problema.

Codice:
Code: [Select]
#include <RingBuffer.h>

/*
This example will receive multiple universes via Artnet and control a strip of ws2811 leds via
Adafruit's NeoPixel library: https://github.com/adafruit/Adafruit_NeoPixel
This example may be copied under the terms of the MIT license, see the LICENSE file for details
*/

#include <Artnet.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <Adafruit_NeoPixel.h>

// Neopixel settings
const int numLeds = 150; // change for your setup
const int numberOfChannels = numLeds * 3; // Total number of channels you want to receive (1 led = 3 channels)
const byte dataPin = 13;
Adafruit_NeoPixel leds = Adafruit_NeoPixel(numLeds, dataPin, NEO_GRB + NEO_KHZ800);

// Artnet settings
Artnet artnet;
const int startUniverse = 1; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as 0.

// Check if we got all universes
const int maxUniverses = numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0);
bool universesReceived[maxUniverses];
bool sendFrame = 1;
int previousDataLength = 0;

// Change ip and mac address for your setup
byte ip[] = {2, 0, 0, 2};
byte mac[] = {0x08, 0xE9, 0xE5, 0x00, 0x69, 0xEC}; // make sure this is different than any other mac address in your network

void setup()
{
  //Serial.begin(115200);
  artnet.begin(mac, ip);
  leds.begin();
  initTest();

  // this will be called for each packet received
  artnet.setArtDmxCallback(onDmxFrame);
}

void loop()
{
  // we call the read function inside the loop
  artnet.read();
}

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{
  sendFrame = 1;
  // set brightness of the whole strip
  if (universe == 15)
  {
    leds.setBrightness(data[0]);
    leds.show();
  }

  // Store which universe has got in
  if ((universe - startUniverse) < maxUniverses)
    universesReceived[universe - startUniverse] = 1;

  for (int i = 0 ; i < maxUniverses ; i++)
  {
    if (universesReceived[i] == 0)
    {
      //Serial.println("Broke");
      sendFrame = 0;
      break;
    }
  }

  // read universe and put into the right part of the display buffer
  for (int i = 0; i < length / 3; i++)
  {
    int led = i + (universe - startUniverse) * (previousDataLength / 3);
    if (led < numLeds)
      leds.setPixelColor(led, data[i * 3], data[i * 3 + 1], data[i * 3 + 2]);
  }
  previousDataLength = length;     
 
  if (sendFrame)
  {
    leds.show();
    // Reset universeReceived to 0
    memset(universesReceived, 0, maxUniverses);
  }
}

void initTest()
{
  for (int i = 0 ; i < numLeds ; i++)
    leds.setPixelColor(i, 127, 0, 0);
  leds.show();
  delay(500);
  for (int i = 0 ; i < numLeds ; i++)
    leds.setPixelColor(i, 0, 127, 0);
  leds.show();
  delay(500);
  for (int i = 0 ; i < numLeds ; i++)
    leds.setPixelColor(i, 0, 0, 127);
  leds.show();
  delay(500);
  for (int i = 0 ; i < numLeds ; i++)
    leds.setPixelColor(i, 0, 0, 0);
  leds.show();
}


Questo è l'errore che mi esce dopo aver importato la libreria dal manager:
Code: [Select]
Arduino:1.8.9 (Mac OS X), Scheda:"Arduino/Genuino Uno"

Opzioni di compilazione cambiate, ricompilo tutto
In file included from /Users/lorenzo /Documents/Arduino/libraries/Ethernet/Ethernet.h:6:0,
                 from /Users/lorenzo /Documents/Arduino/libraries/ArtNet/Artnet.h:24,
                 from /Users/lorenzo /Downloads/artnet-to-ws2812-over-arduino-master/ArtnetPixelSketch/ArtnetPixelSketch.ino:1:
/Users/lorenzo /Documents/Arduino/libraries/Ethernet/Client.h:20:16: error: conflicting return type specified for 'virtual void Client::write(uint8_t)'
   virtual void write(uint8_t);
                ^
In file included from /private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Stream.h:26:0,
                 from /private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/HardwareSerial.h:29,
                 from /private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:232,
                 from sketch/ArtnetPixelSketch.ino.cpp:1:
/private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Print.h:51:20: error:   overriding 'virtual size_t Print::write(uint8_t)'
     virtual size_t write(uint8_t) = 0;
                    ^
In file included from /Users/lorenzo /Documents/Arduino/libraries/Ethernet/Ethernet.h:6:0,
                 from /Users/lorenzo /Documents/Arduino/libraries/ArtNet/Artnet.h:24,
                 from /Users/lorenzo /Downloads/artnet-to-ws2812-over-arduino-master/ArtnetPixelSketch/ArtnetPixelSketch.ino:1:
/Users/lorenzo /Documents/Arduino/libraries/Ethernet/Client.h:22:16: error: conflicting return type specified for 'virtual void Client::write(const uint8_t*, size_t)'
   virtual void write(const uint8_t *buf, size_t size);
                ^
In file included from /private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Stream.h:26:0,
                 from /private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/HardwareSerial.h:29,
                 from /private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:232,
                 from sketch/ArtnetPixelSketch.ino.cpp:1:
/private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Print.h:56:20: error:   overriding 'virtual size_t Print::write(const uint8_t*, size_t)'
     virtual size_t write(const uint8_t *buffer, size_t size);
                    ^
Più di una libreria trovata per "Ethernet.h"
Usata: /Users/lorenzo /Documents/Arduino/libraries/Ethernet
Non usata: /private/var/folders/2m/zvx7m72n0sx7ywpvmf8d_3tw0000gn/T/AppTranslocation/EA481F99-0EE4-4FCA-BF35-7B0588BD3549/d/Arduino.app/Contents/Java/libraries/Ethernet
exit status 1
'using Artnet = class arduino::artnet::Manager<EthernetUDP> {aka class arduino::artnet::Manager<EthernetUDP>}' has no member named 'setArtDmxCallback'

Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
"Mostra un output dettagliato durante la compilazione"
in "File -> Impostazioni"

Go Up