Page 1 of 1

Button Library - multiple instances of class

Posted: 14 Nov 2019 20:01
by niky94547
Hi,

We try to use library ZUNO_Button with multiple instances for buttons. Here is just a sample code with array of two instances...

Code: Select all


#include <ZUNO_Buttons.h>

#define BTN_PIN1 4
#define BTN_PIN2 5


PinButton btn[2][2] = {
  {BTN_PIN1,true}, 
  {BTN_PIN2,true},
  
  };

void setup() {
  Serial.begin(115200);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
}

void loop() {

for( int i=0; i < sizeof 2; ++i ) {
  
  btn[i][i].update();

  btn[i][i].startDispatch();

  if(btn[i][i].isReleased()){
    
  }
  if(btn[i][i].isSingleClick()){
    
  }
  if(btn[i][i].isLongClick()){
    
  }
  if(btn[i][i].isDoubleClick()){
   
  }
  btn[i][i].endDispatch();

delay(20);
}
 } 

and gives us following error on compiler ....

Code: Select all


C:\Users\USER\AppData\Local\Temp\arduino_build_438942\sketch_nov13a_sdcpp_.cpp:874:1:error: uCxx:Can't find method __cxx__PinButton__init00 for object btn of class PinButton

uCxx returned error code:-1

could you suggest any other approach or point our fault. We test same approach with original librarry on Arduino mega and it's ok.

Thanks a lot,

Re: Button Library - multiple instances of class

Posted: 19 Nov 2019 16:36
by rkv
Thank you for your post. This is a bug and we will fix it soon.

Re: Button Library - multiple instances of class

Posted: 22 Nov 2019 14:51
by niky94547
Hi,

Thanks a lot for your reply and support. We look forward to implement library within our project. Just drop an notification once fixed.

Br,