Error message "... not member of ..."

Hi,

I'm just starting to play with arduino projects. I used a code found on internet using a Arduino nano card.

When i try to download the program to the card i get an error message like this :

C:\Users\Alain\Documents\Arduino\sketch_feb14a\sketch_feb14a.ino: In function 'void setup()':
sketch_feb14a:100:11: error: 'PinChangeSetup' is not a member of 'Button'
Button::PinChangeSetup(PIN_SWITCH);
^~~~~~~~~~~~~~
Plusieurs bibliothèque trouvées pour "Button.h"
Utilisé : C:\Users\Alain\Documents\Arduino\libraries\Button
Non utilisé : C:\Users\Alain\Documents\Arduino\libraries\Button-Arduino
Non utilisé : C:\Users\Alain\Documents\Arduino\libraries\ezButton
Non utilisé : C:\Users\Alain\Documents\Arduino\libraries\ButtonTEST
exit status 1

'PinChangeSetup' is not a member of 'Button
> >
'

Please if you can provide a solution. Thanks in advance.

Please if you can provide a solution.

Welcome.

No one can help you if you don’t show your code. Please read https://forum.arduino.cc/index.php?topic=712199.0
Then follow the instructions for posting your code, don’t forget the code tags </>
Thanks.

pinChangeSetup would be a more likely spelling, no? (I don’t have the library)

Sorry,

Here the part of code with the error :

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#include "Button.h"

#define PIN_LED 2
#define PIN_SWITCH 3
#define PIN_POT A0

#define LEDS 128

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDS, PIN_LED, NEO_GRB + NEO_KHZ800);
Button mode = Button(PIN_SWITCH);
bool modepressed = false;

//Physical LED map for bottom and top LED arrays

//LED Bottom (Back looking from top)
//064 049 048 033 032 017 016 001
//063 050 047 034 031 018 015 002
//062 051 046 035 030 019 014 003
//061 052 045 036 029 020 013 004
//060 053 044 037 028 021 012 005
//059 054 043 038 027 022 011 006
//058 055 042 039 026 023 010 007
//057 056 041 040 025 024 009 008
//(Front looking from top)

//LED Top (Back looking from top)
//065 080 081 096 097 112 113 128
//066 079 082 095 098 111 114 127
//067 078 083 094 099 110 115 126
//068 077 084 093 100 109 116 125
//069 076 085 092 101 108 117 124
//070 075 086 091 102 107 118 123
//071 074 087 090 103 106 119 122
//072 073 088 089 104 105 120 121
//(Front looking from top)

const uint8_t botLED[] PROGMEM = {
  64,49,48,33,32,17,16,1,
  63,50,47,34,31,18,15,2,
  62,51,46,35,30,19,14,3,
  61,52,45,36,29,20,13,4,
  60,53,44,37,28,21,12,5,
  59,54,43,38,27,22,11,6,
  58,55,42,39,26,23,10,7,
  57,56,41,40,25,24,9,8,
};

const uint8_t topLED[] PROGMEM = {
  65,80,81,96,97,112,113,128,
  66,79,82,95,98,111,114,127,
  67,78,83,94,99,110,115,126,
  68,77,84,93,100,109,116,125,
  69,76,85,92,101,108,117,124,
  70,75,86,91,102,107,118,123,
  71,74,87,90,103,106,119,122,
  72,73,88,89,104,105,120,121
};

//Storage for current values
int red = 128;
int green = 128;
int blue = 128;
int pattern = 1;

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

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

  pinMode(PIN_LED, OUTPUT);
  pinMode(PIN_SWITCH, INPUT);
  pinMode(PIN_POT, INPUT);
  
  //Pixel Strip
  Serial.println("Setup()");
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

  //Button callbacks
  //mode.Background(ButtonBackground);

  //Set ISR for pin change on MODE pin
  Button::PinChangeSetup(PIN_SWITCH);
}

desjara:
I used a code found on internet

Please post a link to where you found it. The information there may provide helpful context.

Based on the limited information I have now, I can guess that the clue to the problem is here:

desjara:

Plusieurs bibliothèque trouvées pour "Button.h"

Utilisé : C:\Users\Alain\Documents\Arduino\libraries\Button
Non utilisé : C:\Users\Alain\Documents\Arduino\libraries\Button-Arduino
Non utilisé : C:\Users\Alain\Documents\Arduino\libraries\ezButton
Non utilisé : C:\Users\Alain\Documents\Arduino\libraries\ButtonTEST
exit status 1

It looks like you took the ‚Äúshotgun approach‚ÄĚ to library installation and installed every Button library you could find. If the Arduino build system is using a different library from the one the code you found was written for, then it could result in this type of error message.

Here is the link i used for the project. The was provided there.

The library used is Button.

OK, I see the problem. Because many Arduino sketches consist of only a single .ino file, it's easy to assume they are all this way, but Arduino sketches can also contain multiple files. In fact, the folder is the sketch, not the .ino file. The sketch in that Project Hub page contains multiple files:

  • GlueMatrixTest.ino
  • Button.h
  • Button.cpp

You apparently only have GlueMatrixTest.ino in your sketch folder, then thought that you needed to install a library for the missing Button.h, but that file is actually part of the sketch.

You can get the complete sketch by doing this:

  • Go to the "Code" section of the project: Hot Glue LED Matrix Lamp - Arduino Project Hub
  • From the list of files on the left side of the code window, click on "GlueMatrixTest.ino"
  • Click the download button (downward pointing arrow).
  • From the list of files on the left side of the code window, click on "Button.h"
  • Click the download button (downward pointing arrow).
  • From the list of files on the left side of the code window, click on "Button.cpp"
  • Click the download button (downward pointing arrow).

Now you have the files, but unfortunately either the project author or the Project Hub framework has made a complete mess of the file names. It's easy enough to fix though:

  • Rename "gluematrixtest_ino.c" to "GlueMatrixTest.ino".
  • Rename "button_h.h" to "Button.h".
  • Rename "button_cpp.c" to "Button.cpp".

The folder name of an Arduino sketch must match the primary .ino file name. In this case, that is "GlueMatrixTest". So create a folder of that name and then move all three files into that folder.

After that, open the GlueMatrixTest.ino file from the folder you created and give it a try!

Thanks for the quick answer. I'll try that and let you know.

To pert,

Thanks a lot now it's working.

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

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