Compiling error with Uno

Hi. I have a problem compiling this code for Uno board, could someone help me with this?

#include <DMXSerial.h>
#include <FastLED.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

#define OLED_RESET 4
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define LOGO_HEIGHT 12
#define LOGO_WIDTH 16

int DMXAdd = 1;
const int DMXMin = 1;
const int DMXMax = 512;

int buttonStateUp = 0;
int buttonPinUp = 9;

int buttonStateDn = 0;
int buttonPinDn = 8;

static const unsigned char PROGMEM menuIcon[] =
{
  B00000000, B00000000, //
  B01111111, B11111110, //  ##############
  B01111111, B11111110, //  ##############
  B00000000, B00000000, //  ##############
  B00000000, B00000000, //
  B01111111, B11111110, //  ##############
  B01111111, B11111110, //  ##############
  B00000000, B00000000, //  ##############
  B00000000, B00000000, //
  B01111111, B11111110, //  ##############
  B01111111, B11111110, //  ##############
  B00000000, B00000000, //
};
static const unsigned char PROGMEM backIcon[] =
{
  B00000000, B00000000, //
  B00111111, B11111100, //  ##############
  B00111111, B11111100, //  ##############
  B00110000, B00001100, //  ##############
  B00110000, B00001100, //
  B00110000, B00001100, //  ##############
  B00110000, B00001100, //  ##############
  B11111100, B00001100, //  ##############
  B01111000, B00001100, //
  B00110000, B00001100, //  ##############
  B00000000, B00001100, //  ##############
  B00000000, B00000000, //
};
static const unsigned char PROGMEM upIcon[] =
{
  B00000001, B10000000, //
  B00000011, B11000000, //  ##############
  B00000111, B11100000, //  ##############
  B00001110, B01110000, //  ##############
  B00011100, B00111000, //
  B00111000, B00011100, //  ##############
  B01110000, B00001110, //  ##############
  B11111111, B11111111, //  ##############
  B11111111, B11111111, //
  B00000000, B00000000, //  ##############
  B00000000, B00000000, //  ##############
  B00000000, B00000000, //
};
static const unsigned char PROGMEM downIcon[] =
{
  B00000000, B00000000, //
  B00000000, B00000000, //  ##############
  B00000000, B00000000, //  ##############
  B11111111, B11111111, //  ##############
  B11111111, B11111111, //
  B01110000, B00001110, //  ##############
  B00111000, B00011100, //  ##############
  B00011100, B00111000, //  ##############
  B00001110, B01110000, //
  B00000111, B11100000, //  ##############
  B00000011, B11000000, //  ##############
  B00000001, B10000000, //
};

#define NUM_LEDS 16
#define DATA_PIN 5
CRGB leds[NUM_LEDS];

void setup() {
  DMXSerial.init(DMXReceiver);
  FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);

  pinMode(buttonPinUp, INPUT_PULLUP);
  pinMode(buttonPinDn, INPUT_PULLUP);

  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;);
  }

  display.display();
  delay(100);

  display.clearDisplay();

  display.invertDisplay(true);
  delay(1000);
  display.invertDisplay(false);
  delay(1000);

}


void loop() {

  buttonStateUp = digitalRead(buttonPinUp);
  if (buttonStateUp == LOW) {
    DMXAdd++;
    display.clearDisplay();
    if (DMXAdd > DMXMax) {
      DMXAdd = DMXMin;
    }
    delay(50);
  }

  buttonStateDn = digitalRead(buttonPinDn);
  if (buttonStateDn == LOW) {
    
    DMXAdd--;
    display.clearDisplay();
    if (DMXAdd < DMXMin) {
      DMXAdd = DMXMax;
    }
    delay(50);
  }

  display.display();
  display.drawBitmap(0, 16, menuIcon, 16, 12, 1);
  display.drawBitmap(0, 52, backIcon, 16, 12, 1);
  display.drawBitmap(112, 16, upIcon, 16, 12, 1);
  display.drawBitmap(112, 52, downIcon, 16, 12, 1);
  display.display();
  display.setTextColor(WHITE);
  display.setTextSize(2);
  display.setCursor(45, 1);
  display.println("DMX");
  display.setTextSize(3);
  display.setCursor(40, 30);
  display.println(DMXAdd);

  delay(10);

  unsigned long lastPacket = DMXSerial.noDataSince();

  if (lastPacket < 500) {
    leds[0] = CRGB(DMXSerial.read(DMXAdd), DMXSerial.read(DMXAdd + 1), DMXSerial.read(DMXAdd + 2));
    leds[1] = CRGB(DMXSerial.read(DMXAdd + 3), DMXSerial.read(DMXAdd + 4), DMXSerial.read(DMXAdd + 5));
    leds[2] = CRGB(DMXSerial.read(DMXAdd + 6), DMXSerial.read(DMXAdd + 7), DMXSerial.read(DMXAdd + 8));
    leds[3] = CRGB(DMXSerial.read(DMXAdd + 9), DMXSerial.read(DMXAdd + 10), DMXSerial.read(DMXAdd + 11));
    leds[4] = CRGB(DMXSerial.read(DMXAdd + 12), DMXSerial.read(DMXAdd + 13), DMXSerial.read(DMXAdd + 14));
    leds[5] = CRGB(DMXSerial.read(DMXAdd + 15), DMXSerial.read(DMXAdd + 16), DMXSerial.read(DMXAdd + 17));
    leds[6] = CRGB(DMXSerial.read(DMXAdd + 18), DMXSerial.read(DMXAdd + 19), DMXSerial.read(DMXAdd + 20));
    leds[7] = CRGB(DMXSerial.read(DMXAdd + 21), DMXSerial.read(DMXAdd + 22), DMXSerial.read(DMXAdd + 23));
    leds[8] = CRGB(DMXSerial.read(DMXAdd + 24), DMXSerial.read(DMXAdd + 25), DMXSerial.read(DMXAdd + 26));
    leds[9] = CRGB(DMXSerial.read(DMXAdd + 27), DMXSerial.read(DMXAdd + 28), DMXSerial.read(DMXAdd + 29));
    leds[10] = CRGB(DMXSerial.read(DMXAdd + 30), DMXSerial.read(DMXAdd + 31), DMXSerial.read(DMXAdd + 32));
    leds[11] = CRGB(DMXSerial.read(DMXAdd + 33), DMXSerial.read(DMXAdd + 34), DMXSerial.read(DMXAdd + 35));
    leds[12] = CRGB(DMXSerial.read(DMXAdd + 36), DMXSerial.read(DMXAdd + 37), DMXSerial.read(DMXAdd + 38));
    leds[13] = CRGB(DMXSerial.read(DMXAdd + 39), DMXSerial.read(DMXAdd + 40), DMXSerial.read(DMXAdd + 41));
    leds[14] = CRGB(DMXSerial.read(DMXAdd + 42), DMXSerial.read(DMXAdd + 43), DMXSerial.read(DMXAdd + 44));
    leds[15] = CRGB(DMXSerial.read(DMXAdd + 45), DMXSerial.read(DMXAdd + 46), DMXSerial.read(DMXAdd + 47));
    FastLED.show();
  }
}

And I get an error message:

Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"


In file included from C:\Users\Roberts\Desktop\DMX_TEST_02\DMX_TEST_02.ino:2:0:

C:\Users\Roberts\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.003.003

 #    pragma message "FastLED version 3.003.003"

                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_18'

libraries\DMXSerial\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_19'

libraries\DMXSerial\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "DMXSerial.h"

 Used: C:\Users\Roberts\Documents\Arduino\libraries\DMXSerial

 Not used: C:\Users\Roberts\Documents\Arduino\libraries\DMXSerial-master

exit status 1

Error compiling for board Arduino Uno.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

The "PRAGMA" message can be ignored.
The other errors are actually in your code.
They do suggest a library error.
More likely you are compiling a code for the wrong library.

The DMXSerial library is using the same interrupt vectors as HardwareSerial. You can use one or the other but not both. If you need DMXSerial then you have to remove every reference to 'Serial'.

Thanks. Silly me :slight_smile: Got rid of Serial and all works now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.