Error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'

Good evening,

I am reaching out to this forum as I have code that works perfectly fine when using the Arduino app but once I upload it to the Arduino IOT editor I receive such an error - /mnt/create-efs/webide/35/eb/35eb276a2a05b3caef1783c1c6af0970:jduck3/libraries_v2/Adafruit NeoPixel/esp8266.c:20:11: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void'

IRAM_ATTR void espShow(

^

Error during build: exit status 1

BTW here is such code:

#include <Adafruit_NeoPixel.h>


#define PIXELS_PER_SEGMENT  1     // Number of LEDs in each Segment
#define PIXELS_DIGITS       1    // Number of connected Digits 
#define PIXELS_PIN          14     // GPIO Pin

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXELS_PER_SEGMENT * 7 * PIXELS_DIGITS, PIXELS_PIN, NEO_GRB + NEO_KHZ800);


//Digits array
byte digits[10] = {
  //abcdefg
  0b0000000,     // 0
  0b0000001,     // 1
  0b0000010,     // 2
  0b0000011,     // 3
  0b0000100,     // 4
  0b0000101,     // 5
  0b0000110,     // 6
  0b0000111,     // 7
  0b0001000,     // 8
  0b0001001      // 9
};

//Clear all the Pixels
void clearDisplay() {
  for (int i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, strip.Color(0, 0, 0));
  }
  strip.show();
}

void setup() {
  strip.begin();
  Serial.begin(115200);
}

void loop() {
  disp_Digits(1500);            // Show digits from 0-9(DelayTime)
  //disp_Digit();
}

void disp_Digits(int wait) {
  clearDisplay();
  for (int i = 0; i < 10; i++) {
    for (int n = 0; n < PIXELS_DIGITS; n++) {
      writeDigit(n, i);
      Serial.println(n);
    }
    strip.show();
    delay(wait);
  }
}

/*
void disp_Digit() {
  clearDisplay();  
  
 writeDigit(n, i);
}
*/

void writeDigit(int index, int val) {
  byte digit = digits[val];
  for (int i = 6; i >= 0; i--) {
    int offset = index * (PIXELS_PER_SEGMENT * 7) + i * PIXELS_PER_SEGMENT;
    uint32_t color;
    if (digit & 0x01 != 0) {
      if (val == 1) color = strip.Color(50, 0, 0);
      if (val == 2) color = strip.Color(50, 0, 0);
      if (val == 3) color = strip.Color(50, 0, 0);
      if (val == 4) color = strip.Color(50, 0, 0);
      if (val == 5) color = strip.Color(50, 0, 0);
      if (val == 6) color = strip.Color(50, 0, 0);
      if (val == 7) color = strip.Color(50, 0, 0);
      if (val == 8) color = strip.Color(50, 0, 0);
      if (val == 9) color = strip.Color(50, 0, 0);
      if (val == 0) color = strip.Color(50, 0, 0);
    }
    else
      color = strip.Color(0, 0, 0);

    for (int j = offset; j < offset + PIXELS_PER_SEGMENT; j++) {
      strip.setPixelColor(j, color);
    }
    digit = digit >> 1;
  }
}

If anyone had any suggestions I would appreciate it!

Best,
Jared

1 Like

You have got to be kidding me... an array where every element is just its index.

I am quite new to Arduino but this sketch does work on the downloadable platform. Just curious why it doesn't on the IoT one.

I can tell you one thing, the error happens in the Adafruit library, not your code...

ya you are correct I have tried a couple of different codes back and forth and all the same error on the IoT platform. Would there be any way to fix the library @anon57585045 ?

I'll stand back for the experts on the IoT editor to arrive...
Is it always with the Adafruit library, or no?

Thanks for your help ill wait for them

You can delete that array and use:

  byte digit = val;

Thanks again

Good catch but you missed one

Has the OP considered that the issue seems to be the Adafruit library. Adafruit has an active presence on GitHub. If one went to github and found the AdaFruity neopixel page and one was to open up a issue, posting the code and the error message. That, in short order, the person who's job it is to maintain the code will read the issue and follow up on it.

OR.

The OP can wait here for the Adafruit person to find this post and respnd. Good luck.

Good evening,

I apologize in advance if either a) this is a known issue that I just couldn't find or b) I'm an idiot

With that being said I am struggling with connecting the Adafruit_NeoPixel library with the IoT Cloud and continue to get this error

error: expected '=', ',', ';', 'asm' or 'attribute' before 'void'

is this solvable?

Best,
Jared

Certainly not. All of us are born ignorant but have the chance of learning, growing.

A first step could be reading the very first topic telling how to get the best from this forum, what common documentation is wanted.
Where is the source of the error You tell about?
Where is the total error message?

Know that all helpers are complete newbies to Your specific project! Be happy that we are not ghosts hanging around all the time..

Being involved in building really large system in the industri I've learned lots.
Verify every little subsystem from the lowest level. Then start to integrate one subsystem at the time. Don't throw all parts in a sack, shaking it and thinking anything would work.

What subsystem verifications have You done?

Appreciate it!

So the error message is NeoPixel/esp8266.c:20:11: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void'

And I know for a fact it has something to do with the library as that message occurs whenever any sketch is copied and pasted from the normal Arduino app to the IoT editor.

Best,
Jared

You did not read the reply in #2,qutoed below.

No offence but You're unnecessarily consuming helpers time forcing us to ask for basic information, asked for in the advice.

Give us the basic facts. Use Your theories in Your project. They don't help us.

I've merged your cross-posts @j333duck.

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide you will find at the top of every forum category. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

Hi @j333duck. The reason for this difference between your results in the Arduino IDE vs. Arduino Web Editor is revealed by this line you will find in the contents of the console pane of the Arduino Web Editor window after the compilation fails:

Using core 'esp8266' from platform in folder: /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0

The important part is the "2.5.0". What that tells us is that Arduino Create is using a very outdated version of the esp8266 boards platform. You have a newer version of the boards platform installed on your computer.

The latest version of the "Adafruit Neopixel" library is not compatible with the old version of the esp8266 boards platform used by Arduino Web Editor. This is the cause of the error.

Since there is no way to update the version of the esp8266 boards platform in Arduino Web Editor, the alternative is to roll back to the latest version of the "Adafruit Neopixel" library that is compatible. I found the breaking change in the library was made in the 1.8.5 release, so this means you will need to use version 1.8.4 of the library.

I'll provide you with instructions for doing that:

  1. Open your sketch in Arduino Web Editor.
  2. From the menu on the left side of the Arduino Web Editor window, click "Libraries".
  3. Click the Library Manager button.
  4. Search for "adafruit neopixel".
  5. Find "ADAFRUIT NEOPIXEL" in the search results.
  6. If the star to the right of the library is not already filled, click the star.
    This will add the library to your "Favorites" in Arduino Web Editor.
  7. Click the Done button.
  8. From the Libraries pane of the Arduino Web Editor window, click the "Favorites" tab.
  9. Find "Adafruit Neopixel" in the list of favorite libraries and hover the mouse pointer over "Adafruit Neopixel".
  10. Click the downward pointing triangle on the right side of the Include button.
  11. Click "Version 1.8.4".
    This configures the metadata of the currently opened sketch to use version 1.8.4 of the Adafruit Neopixel library.
  12. Now look at your sketch. You will find that three lines have been added at the top:
    // Adafruit NeoPixel - Version: 1.8.4
    #include <Adafruit_NeoPixel.h>
    #include <rp2040_pio.h>
    
  13. The first two have no effect, but the third should only be used when compiling for a Raspberry Pi RP2040-based board. Since you are using ESP8266, that can not be used. So delete all three of those lines.

The sketch should now compile successfully.

6 Likes

You rock, this is the exact answer I was seeking!

I'm glad to hear it was useful to you.

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