Cannot get this downloaded code to function. Compilation error: exit status 1

Hello. I am very new to coding in general and this is my first arduino project. I found a similar project to what I want and have downloaded the code character for character and come up with compile errors i will paste below. I suspect it is a library problem? though I did my best to make sure I have the same version of the FastLED library the owner used. I searched here and found other examples of people having trouble with this same project but nobody with my same issue. mostly hardware problems or little glitches in code, mine won't even load. Cheers and thanks for taking a look.

Here is the code used, link where I found it and copied.

steps taken so far.
triple checked I got every character of code
revert back to as downloaded code, I had changed some parameters to match my LED strips.
reinstalled the fastLED library, both with the most up to date and the version used in the code.
restart PC
reinstalled IDE

//Modern turn lights v.1.0.0 with arduino and ws2812b by Fedaceag Ionut

#include <FastLED.h>                        //FastLed library version 3.2.1 - https://github.com/FastLED/FastLED/wiki/Overview or http://fastled.io/ with NEOPIXEL or WS2812B

#define NUM_STRIPS 2                        // number of led strips (in this example are front left and front right)

#define NUM_LEDS_PER_STRIP 20               // number of leds per each strip

CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP];

uint8_t gHue = 0;                           // rotating "base color" used by many of the patterns

const int buttonPinL = 2;                   // turn left

const int buttonPinR = 3;                   // turn right

const int buttonPinEng = 4;                 // engine on to start day lights

const int buttonPinKnightRider = 5;         // knight rider lights

int buttonStateL = 0;

int buttonStateR = 0;

int engineOn = 0;

int KnightRiderState = 0;

int stateL = 0;

int stateR = 0;

uint8_t gBrtL = 0;

uint8_t gBrtR = 0;

int maxBrt = 120;                           // maxim brightness day lights - from 0 to 255

int delayTurnLedAnim = 25; //delay of each led in turn light animation

int delayTurnLedOff = 250; //delay from animation to black (is used twice)

int delayLedToDayLight = 500; // delay from animation to day light on

int nrAnimAfterOff = 3; // number of animations for a single impulse

void setup() { 

  //Serial.begin(9600);

  pinMode(buttonPinL, INPUT);

  pinMode(buttonPinR, INPUT);

  pinMode(buttonPinEng, INPUT);

  pinMode(buttonPinKnightRider, INPUT);

  

  FastLED.addLeds<NEOPIXEL, 8>(leds[0], NUM_LEDS_PER_STRIP); //led strip for front left

  FastLED.addLeds<NEOPIXEL, 9>(leds[1], NUM_LEDS_PER_STRIP); //led strip for front right

  

  attachInterrupt(digitalPinToInterrupt(buttonPinL),btnPressL,RISING); // we use interrupt for instant reaction of turn lights

  attachInterrupt(digitalPinToInterrupt(buttonPinR),btnPressR,RISING); // we use interrupt for instant reaction of turn lights

  fill_solid(leds[0], NUM_LEDS_PER_STRIP, CRGB::Black); // some led strips are all on at power on, so let's power them off at boot

  fill_solid(leds[1], NUM_LEDS_PER_STRIP, CRGB::Black); // some led strips are all on at power on, so let's power them off at boot

  FastLED.show();

}

void loop() {

  // read the input state

    buttonStateL = digitalRead(buttonPinL); 

    buttonStateR = digitalRead(buttonPinR);

    KnightRiderState = digitalRead(buttonPinKnightRider);

    EVERY_N_MILLISECONDS( 1 ){

      engineOn = digitalRead(buttonPinEng);

    }

  //function for hazard lights

  if(stateL != 0 && stateR != 0){ 

    

    for(int dot = 0; dot < NUM_LEDS_PER_STRIP; dot++) { 

        leds[0][dot] = 0xff6a00; // color for left turn light

        leds[1][dot] = 0xff6a00; // color for right turn light

        FastLED.show();

        delay(delayTurnLedAnim);

    }

    

    delay(delayTurnLedOff);

    fill_solid(leds[0], NUM_LEDS_PER_STRIP, CRGB::Black);

    fill_solid(leds[1], NUM_LEDS_PER_STRIP, CRGB::Black);

    FastLED.show();

    delay(delayTurnLedOff);

    if(buttonStateL != HIGH || buttonStateR != HIGH){

      

      if(buttonStateL == HIGH){

        stateL = 1;

      }else{

        stateL = 0;

        gBrtL = 0;

      }

      

      if(buttonStateR == HIGH){

        stateR = 1;

      }else{

        stateR = 0;

        gBrtR = 0;

      }

      

      if(buttonStateL != HIGH && buttonStateR != HIGH){

        delay(delayLedToDayLight);        

      }

      

    }

  //function for left turn lights

  }else if(stateL != 0){

    

    if(KnightRiderState == HIGH && engineOn == LOW){

      fill_solid(leds[1], NUM_LEDS_PER_STRIP, CRGB::Black);

    }

    

    for(int dot = 0; dot < NUM_LEDS_PER_STRIP; dot++) { 

        leds[0][dot] = 0xff6a00; // color for left turn light

        FastLED.show();

        delay(delayTurnLedAnim);

    }

    

    delay(delayTurnLedOff);

    fill_solid(leds[0], NUM_LEDS_PER_STRIP, CRGB::Black);

    FastLED.show();

    delay(delayTurnLedOff);

    stateL++;

    if(stateL >= nrAnimAfterOff && buttonStateL != HIGH){

      stateL = 0;

      gBrtL = 0;

      delay(delayLedToDayLight);

    }

  //function for right turn lights

  }else if(stateR != 0){

    

    if(KnightRiderState == HIGH && engineOn == LOW){

      fill_solid(leds[0], NUM_LEDS_PER_STRIP, CRGB::Black);

    }

      

    for(int dot = 0; dot < NUM_LEDS_PER_STRIP; dot++) { 

        leds[1][dot] = 0xff6a00; // color for right turn light

        FastLED.show();

        delay(delayTurnLedAnim);

    }

    

    delay(delayTurnLedOff);

    fill_solid(leds[1], NUM_LEDS_PER_STRIP, CRGB::Black);

    FastLED.show();

    delay(delayTurnLedOff);

    stateR++;

    if(stateR >= nrAnimAfterOff && buttonStateR != HIGH){

      stateR = 0;

      gBrtR = 0;

      delay(delayLedToDayLight);

    }

    

  }else{

    

    if(stateL == 0 && engineOn == HIGH){

      if(gBrtL <= maxBrt){

        EVERY_N_MILLISECONDS( 1 ) { gBrtL++; } 

        fill_solid( leds[0], NUM_LEDS_PER_STRIP, CHSV(0,0,gBrtL));

        FastLED.show();

      }

    }else{

      if(gBrtL > 0){

        EVERY_N_MILLISECONDS( 1 ) { gBrtL--; } 

        fill_solid( leds[0], NUM_LEDS_PER_STRIP, CHSV(0,0,gBrtL));

        FastLED.show();

      }else{

        if(KnightRiderState == HIGH){          

          gHue = 0;

          //EVERY_N_MILLISECONDS( 20 ) { gHue++; }

          fadeToBlackBy( leds[0], NUM_LEDS_PER_STRIP, 20);

          int pos = beatsin16( 30, 0, NUM_LEDS_PER_STRIP-1 );

          leds[0][pos] += CHSV( gHue, 255, 192);

          FastLED.show();

        }

      }

    }

    if(stateR == 0 && engineOn == HIGH){

      if(gBrtR <= maxBrt){     

        EVERY_N_MILLISECONDS( 1 ) { gBrtR++; }

        fill_solid( leds[1], NUM_LEDS_PER_STRIP, CHSV(0,0,gBrtR));

        FastLED.show();  

      }     

    }else{

      if(gBrtR > 0){        

        EVERY_N_MILLISECONDS( 1 ) { gBrtR--; }

        fill_solid( leds[1], NUM_LEDS_PER_STRIP, CHSV(0,0,gBrtR));

        FastLED.show();

      }else{

        if(KnightRiderState == HIGH){          

          gHue = 0;

          //EVERY_N_MILLISECONDS( 20 ) { gHue++; }

          fadeToBlackBy( leds[1], NUM_LEDS_PER_STRIP, 20);

          int pos = beatsin16( 30, 0, NUM_LEDS_PER_STRIP-1 );

          leds[1][pos] += CHSV( gHue, 255, 192);

          FastLED.show();

        }

      }

    }

  }

}

void btnPressL(){

  stateL = 1;

  for(int nr = 0; nr < 1500; nr++) { 

    buttonStateR = digitalRead(buttonPinR);

    if(buttonStateR == 1){

        stateR = 1;     

      }

  }

}

void btnPressR(){

   stateR = 1;

   for(int nr = 0; nr < 1500; nr++) { 

     buttonStateL = digitalRead(buttonPinL); 

     if(buttonStateL == 1){

        stateL = 1;

      }

   }

}

and this is the error sequence I get.

In file included from C:\Users\Steepers\Documents\Arduino\semnalizare front only as DL\semnalizare front only as DL.ino:2:0:
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.002

pragma message "FastLED version 3.002.002"

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

In file included from C:\Users\Steepers\Documents\Arduino\libraries\FastLED/FastLED.h:65:0,
from C:\Users\Steepers\Documents\Arduino\semnalizare front only as DL\semnalizare front only as DL.ino:2:
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/fastspi.h:110:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

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

In file included from C:\Users\Steepers\Documents\Arduino\libraries\FastLED/FastLED.h:48:0,
from C:\Users\Steepers\Documents\Arduino\semnalizare front only as DL\semnalizare front only as DL.ino:2:
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/fastpin.h: In instantiation of 'class FastPin<8>':
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:96:49: required from 'class ClocklessController<8, 4, 10, 6, (EOrder)66, 0, false, 10>'
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/chipsets.h:457:7: required from 'class WS2812Controller800Khz<8, (EOrder)66>'
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/FastLED.h:92:34: required from 'class NEOPIXEL<8>'
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/FastLED.h:314:28: required from 'static CLEDController& CFastLED::addLeds(CRGB*, int, int) [with CHIPSET = NEOPIXEL; unsigned char DATA_PIN = 8]'
C:\Users\Steepers\Documents\Arduino\semnalizare front only as DL\semnalizare front only as DL.ino:37:59: required from here
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/fastpin.h:207:2: error: static assertion failed: Invalid pin specified
static_assert(validpin(), "Invalid pin specified");
^~~~~~~~~~~~~
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/fastpin.h: In instantiation of 'class FastPin<9>':
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/platforms/avr/clockless_trinket.h:96:49: required from 'class ClocklessController<9, 4, 10, 6, (EOrder)66, 0, false, 10>'
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/chipsets.h:457:7: required from 'class WS2812Controller800Khz<9, (EOrder)66>'
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/FastLED.h:92:34: required from 'class NEOPIXEL<9>'
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/FastLED.h:314:28: required from 'static CLEDController& CFastLED::addLeds(CRGB*, int, int) [with CHIPSET = NEOPIXEL; unsigned char DATA_PIN = 9]'
C:\Users\Steepers\Documents\Arduino\semnalizare front only as DL\semnalizare front only as DL.ino:38:59: required from here
C:\Users\Steepers\Documents\Arduino\libraries\FastLED/fastpin.h:207:2: error: static assertion failed: Invalid pin specified

Compilation error: exit status 1

It built fine for me using fastled_3_5_0 and Arduino UNO or Arduino Mega.

OK. I am using a Nano Every. do you think that could be the problem? is it something weird to do with how my library is stored? I figured the code was good as lots of people have been using it for various projects, but I just cant seem to get it to compile.

edit. I have gotten code from other sources to build fine. much simpler programs. including some I built myself on tutorials.

I suggest that you upgrade your version of FastLED to the latest version. It is available via the IDE library manager which is the preferred way to install or upgrade libraries.

Also, I built with the online Arduino editor and selected Nano Every with Registers Emulation set to none and it worked fine.

this is how I installed both the latest and the version they reference in the code. neither seems to make any difference. Other code using fastLED has functioned for me just fine and I have gotten my strips to "do stuff"

Using the online editor with the latest fastLED library and it still would not build. copied errors below.


/usr/local/bin/arduino-cli compile --fqbn arduino:megaavr:nona4809:mode=on --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/044744396/build --build-path /tmp/arduino-build-18E4C84BB3E62F4DC3161C48B1EFB334 /tmp/044744396/sketch_mar10a

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DAVR_NANO_4809_328MODE -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP -I/home/builder/.arduino15/packages/arduino/hardware/megaavr/1.8.7/cores/arduino/api/deprecated -I/home/builder/.arduino15/packages/arduino/hardware/megaavr/1.8.7/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/megaavr/1.8.7/variants/nona4809 -I/home/builder/opt/libraries/latest/fastled_3_5_0/src /tmp/arduino-build-18E4C84BB3E62F4DC3161C48B1EFB334/sketch/sketch_mar10a.ino.cpp -o /tmp/arduino-build-18E4C84BB3E62F4DC3161C48B1EFB334/sketch/sketch_mar10a.ino.cpp.o

Using library fastled_3_5_0 at version 3.5.0 in folder: /home/builder/opt/libraries/fastled_3_5_0

In file included from /home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/fastled_avr.h:4:0,

from /home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms.h:41,

from /home/builder/opt/libraries/latest/fastled_3_5_0/src/FastLED.h:54,

from /tmp/044744396/sketch_mar10a/sketch_mar10a.ino:3:

/home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/fastpin_avr.h: In instantiation of 'static void _AVRPIN<PIN, _MASK, _PORT, _DDR, _PIN>::setOutput() [with unsigned char PIN = 9; unsigned char _MASK = 1; _PORT = __gen_struct_VPORTB_OUT; _DDR = __gen_struct_VPORTB_DIR; _PIN = __gen_struct_VPORTB_IN]':

/home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/clockless_trinket.h:114:31: required from 'void ClocklessController<DATA_PIN, T1, T2, T3, RGB_ORDER, XTRA0, FLIP, WAIT_TIME>::init() [with unsigned char DATA_PIN = 9; int T1 = 4; int T2 = 10; int T3 = 6; EOrder RGB_ORDER = (EOrder)66; int XTRA0 = 0; bool FLIP = false; int WAIT_TIME = 10]'

/tmp/044744396/sketch_mar10a/sketch_mar10a.ino:391:1: required from here

/home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/fastpin_avr.h:22:42: error: incomplete type '__gen_struct_VPORTB_DIR' used in nested name specifier

inline static void setOutput() { _DDR::r() |= _MASK; }

~~~~~~~^~

/home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/fastpin_avr.h: In instantiation of 'static volatile uint8_t* _AVRPIN<PIN, _MASK, _PORT, _DDR, _PIN>::port() [with unsigned char PIN = 9; unsigned char _MASK = 1; _PORT = __gen_struct_VPORTB_OUT; _DDR = __gen_struct_VPORTB_DIR; _PIN = __gen_struct_VPORTB_IN; _AVRPIN<PIN, _MASK, _PORT, _DDR, _PIN>::port_ptr_t = volatile unsigned char*; uint8_t = unsigned char]':

/home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/clockless_trinket.h:362:44: required from 'static void ClocklessController<DATA_PIN, T1, T2, T3, RGB_ORDER, XTRA0, FLIP, WAIT_TIME>::showRGBInternal(PixelController<RGB_ORDER>&) [with unsigned char DATA_PIN = 9; int T1 = 4; int T2 = 10; int T3 = 6; EOrder RGB_ORDER = (EOrder)66; int XTRA0 = 0; bool FLIP = false; int WAIT_TIME = 10]'

/home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/clockless_trinket.h:126:19: required from 'void ClocklessController<DATA_PIN, T1, T2, T3, RGB_ORDER, XTRA0, FLIP, WAIT_TIME>::showPixels(PixelController<RGB_ORDER>&) [with unsigned char DATA_PIN = 9; int T1 = 4; int T2 = 10; int T3 = 6; EOrder RGB_ORDER = (EOrder)66; int XTRA0 = 0; bool FLIP = false; int WAIT_TIME = 10]'

/tmp/044744396/sketch_mar10a/sketch_mar10a.ino:391:1: required from here

/home/builder/opt/libraries/latest/fastled_3_5_0/src/platforms/avr/fastpin_avr.h:39:84: error: incomplete type '__gen_struct_VPORTB_OUT' used in nested name specifier

inline static port_ptr_t port() __attribute__ ((always_inline)) { return &_PORT::r(); }

~~~~~~~~^~

Error during build: exit status 1

I can duplicate with the online Arduino Editor if I set Registers Emulation to ATMEGA328. If I use no register emulation (ATMEGA4809) it builds fine.

That is about as much as I can help because I don't have a Nano Every.

In case it is not clear, I'll provide instructions for configuring Arduino Web Editor so that your FastLED sketch can compile for the Nano Every:

  1. Click on the board selector menu in Arduino Web Editor:
    image
  2. Click on "Select Other Board & Port".
  3. Type arduino nano every in the "BOARDS" field of the "Select Other Board & Port" dialog that opens.
  4. Select "Arduino Nano Every" from the search results.
  5. Click on the "FLAVOURS" menu.
  6. Select "None (ATMEGA4809)" from the menu.
    image
  7. Click the OK button.

Now try compiling your sketch again.

Legend! Thank you. I got this running. Weird i can't get it to load on my pc ide even wirh changing that setting but im not too worried about that. Now to setup my circuit and test it out!

I would recommend making sure you have the latest version of FastLED installed. I know the Nano Every support was added to that library relatively recently, so an older version might fail to compile for the board.

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