Expected primary-expression before 'void' please help

Hello, i have this stupid error message "expected primary-expression before 'void' "
it drives me crazy that i can't fidure it out and if anyone can help please feel free to answer. I have a NeoPixel Presentation at my school next week and i really need this program to work. Thanks.

i can't upload the file so please copy paste it.

#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif
#define LED_PIN 6
#define LED_COUNT 60
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
#define PIN 6
#define NUMPIXELS 60
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int taster = 7;
int tasterstatus = 0;
#define DELAYVAL 500
#define colorWipe
#define reverseColorWipe
#define theaterChase
#define rainbow
#define theaterChaseRainbow

void setup() {
#if defined(AVR_ATtiny85) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif

delay(180000);

strip.begin();
strip.show();
strip.setBrightness(50);

pinMode(taster, INPUT);

}

void loop() {

tasterstatus = digitalRead(taster);
if (tasterstatus == HIGH)
{
pixels.clear();
for (int i = 0; i < NUMPIXELS; i++) {

  pixels.setPixelColor(i, pixels.Color(0, 150, 0));

  pixels.show();
  delay(DELAYVAL);
}

}
else
{

colorWipe(strip.Color         (255,   0,   0), 50);
reverseColorWipe(strip.Color  (  0, 255,   0), 50);
colorWipe(strip.Color         (  0,   0, 255), 50);

theaterChase(strip.Color(127, 127, 127), 50);
theaterChase(strip.Color(127,   0,   0), 50);
theaterChase(strip.Color(  0,   0, 127), 50);

rainbow(10);
theaterChaseRainbow(50);

}

void colorWipe(uint32_t color, int wait) {
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}

void reverseColorWipe(uint32_t c, uint8_t wait) {
for (int16_t i = (strip.numPixels() - 1); i >= 0; i--) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

void theaterChase(uint32_t color, int wait) {
for (int a = 0; a < 10; a++) {
for (int b = 0; b < 3; b++) {
strip.clear();
for (int c = b; c < strip.numPixels(); c += 3) {
strip.setPixelColor(c, color);
}
strip.show();
delay(wait);
}
}
}

void rainbow(int wait) {
for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
for (int i = 0; i < strip.numPixels(); i++) {
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
}
strip.show();
delay(wait);
}
}

void theaterChaseRainbow(int wait) {
int firstPixelHue = 0;
for (int a = 0; a < 30; a++) {
for (int b = 0; b < 3; b++) {
strip.clear();
for (int c = b; c < strip.numPixels(); c += 3) {
int hue = firstPixelHue + c * 65536L / strip.numPixels();
uint32_t color = strip.gamma32(strip.ColorHSV(hue));
strip.setPixelColor(c, color);
}
strip.show();
delay(wait);
firstPixelHue += 65536 / 90;
}
}
}

Please edit your post and put the code in code tags to make that easier

See How to get the best out of this forum

Where does the rainbow() function end ?
You are missing several } at the end of functions

void loop() {
    tasterstatus = digitalRead(taster);
    if (tasterstatus == HIGH)
    {
        pixels.clear();
        for (int i = 0; i < NUMPIXELS; i++) {
            pixels.setPixelColor(i, pixels.Color(0, 150, 0));
            pixels.show();
            delay(DELAYVAL);
        }
    }
    else
    {
        colorWipe(strip.Color         (255,   0,   0), 50);
        reverseColorWipe(strip.Color  (  0, 255,   0), 50);
        colorWipe(strip.Color         (  0,   0, 255), 50);
        theaterChase(strip.Color(127, 127, 127), 50);
        theaterChase(strip.Color(127,   0,   0), 50);
        theaterChase(strip.Color(  0,   0, 127), 50);
        rainbow(10);
        theaterChaseRainbow(50);
    }
    void colorWipe(uint32_t color, int wait) {
        for (int i = 0; i < strip.numPixels(); i++) {
            strip.setPixelColor(i, color);

when properly formatted, it's obvious that there should be a closing brace before "void colorWipe"

please post code using </>

this ^^^^ and the other defines. You are telling preprocessor to replace colorWipe with nothing. so your function definition

will look like

void (uint32_t color, int wait) {

after replacement

If i „undefine“ these then is says they are not defined. I‘ll send the code again later because i don‘t have my computer with me rn. But thanks

When you open a set of curly braces do you close it then fill in the code or do you wait to close it until after you've written the code?

I first do the {} and then the code. In the end i use auto format to Get a better overview

apparently not with the code posted above. ??

No… should i send it again?

here's the full code again. formated.

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define LED_PIN    6
#define LED_COUNT 60
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
#define PIN        6
#define NUMPIXELS 60
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int taster = 7;
int tasterstatus = 0;
#define DELAYVAL 500
#define colorWipe             
#define reverseColorWipe      
#define theaterChase          
#define rainbow               
#define theaterChaseRainbow   


void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif

  delay(180000);

  strip.begin();
  strip.show();
  strip.setBrightness(50);

  pinMode(taster, INPUT);

}



void loop() {

  tasterstatus = digitalRead(taster);
  if (tasterstatus == HIGH)
  {
    pixels.clear();
    for (int i = 0; i < NUMPIXELS; i++) {

      pixels.setPixelColor(i, pixels.Color(0, 150, 0));

      pixels.show();
      delay(DELAYVAL);
    }
  }
  else
  {

    colorWipe(strip.Color         (255,   0,   0), 50);
    reverseColorWipe(strip.Color  (  0, 255,   0), 50);
    colorWipe(strip.Color         (  0,   0, 255), 50);

    theaterChase(strip.Color(127, 127, 127), 50);
    theaterChase(strip.Color(127,   0,   0), 50);
    theaterChase(strip.Color(  0,   0, 127), 50);

    rainbow(10);
    theaterChaseRainbow(50);
  }

  void colorWipe(uint32_t color, int wait) {
    for (int i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, color);
      strip.show();
      delay(wait);
    }
  }

  void reverseColorWipe(uint32_t c, uint8_t wait) {
    for (int16_t i = (strip.numPixels() - 1); i >= 0; i--) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
    }
  }


  void theaterChase(uint32_t color, int wait) {
    for (int a = 0; a < 10; a++) {
      for (int b = 0; b < 3; b++) {
        strip.clear();
        for (int c = b; c < strip.numPixels(); c += 3) {
          strip.setPixelColor(c, color);
        }
        strip.show();
        delay(wait);
      }
    }
  }

  void rainbow(int wait) {
    for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
      for (int i = 0; i < strip.numPixels(); i++) {
        int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
        strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
      }
      strip.show();
      delay(wait);
    }
  }

  void theaterChaseRainbow(int wait) {
    int firstPixelHue = 0;
    for (int a = 0; a < 30; a++) {
      for (int b = 0; b < 3; b++) {
        strip.clear();
        for (int c = b; c < strip.numPixels(); c += 3) {
          int      hue   = firstPixelHue + c * 65536L / strip.numPixels();
          uint32_t color = strip.gamma32(strip.ColorHSV(hue));
          strip.setPixelColor(c, color);
        }
        strip.show();
        delay(wait);
        firstPixelHue += 65536 / 90;
      }
    }
  }
}

Look at the indentation. Why is colorWipe indented? Because there is a missing closing bracket above it.

But it's about "theaterChaseRainbow". that's where the primary expression is expected.

The compiler sometimes complains about the last thing it found. Look at your loop function - it's clearly broken.

What do you mean with broken? Can you please explain. I’m still new to programming…

Your loop function is missing one of these } at the end.

No it’s not. I already checked ALL the {}. There is one } for every { . If you still think you’re right, please correct the text and paste it again in your next answer. Thanks.

Probably easier if you took willbills advice and ADD the MISSING } at the end of the loop function!!

  1. I added it at the end of the script: still the message “expected primary-expression before ‘void’ (line with void theaterChaseRainbow is marked red).
  2. I added it before ‘else’: error message “expected unqualified-id before ‘else’ “
    WHERE should i add it. That’s all I’m asking.

@cherk please copy my script and paste it in your arduino program (i use 1.8.5) and try it out for yourself

Yes, it is; don't be stubborn. Look at the properly formatted output; in the below I've added dots to make it more visiable where the spaces are.

void loop() {
  your loop code here
..}

..void colorWipe(uint32_t color, int wait) {

That last line should start at the beginning of a line.