Error in compilation with OneButton Library

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
bartdesign
Posts: 1
Joined: 26 Dec 2017 16:22

Error in compilation with OneButton Library

Post by bartdesign » 26 Dec 2017 16:29

Hi,

I have a quick question, I'm trying to use the OneButton library.(https://github.com/mathertel/OneButton) I can get it to compile; but it runs into the following error.

Code: Select all

	*** Collecting prototypes...
Preprocessing file: Custom.c with SDCPP... 

Preprocessing file: Print.cpp with SDCPP... 
Compiling Print_sdcpp_.cpp ...
Preprocessing file: Stream.cpp with SDCPP... 
Compiling Stream_sdcpp_.cpp ...
Preprocessing file: HardwareSerial.cpp with SDCPP... 
Compiling HardwareSerial_sdcpp_.cpp ...
Preprocessing file: HLCore.cpp with SDCPP... 
Compiling HLCore_sdcpp_.cpp ...
Preprocessing file: OneButton.cpp with SDCPP... 
Compiling OneButton_sdcpp_.cpp ...
Preprocessing file: Switch.cpp with SDCPP... 
Compiling Switch_sdcpp_.cpp ...['__cxx__Stream__method__findUntil_02p05p0d', '__cxx__OneButton__method__attachPress_0165', '__cxx__HardwareSerial__method__readBytes_02p0509', '__cxx__Stream__method__peekNextDigit_00', '__cxx__Print__method__print_010d', '__cxx__OneButton__method__attachDuringLongPress_0165', '__cxx__HardwareSerial__method__print_020905', '__cxx__Stream__method__getWriteError_00', '__cxx__Stream__method__read_00', '__cxx__Stream__method__findUntil_02p0dp0d', '__cxx__HardwareSerial__method__peekNextDigit_00', '__cxx__Stream__method__find_010d', '__cxx__Stream__method__println_021605', '__cxx__Stream__method__parseFloat_010d', '__cxx__Stream__method__write_02p0509', '__cxx__HardwareSerial__method__end_00', '__cxx__Stream__method__timedPeek_00', '__cxx__HardwareSerial__method__readBytes_02p0d09', '__cxx__HardwareSerial__method__getWriteError_00', '__cxx__HardwareSerial__method__setWriteError_0111', '__cxx__HardwareSerial__method__println_021105', '__cxx__Stream__method__dumpPrint_02p0505', '__cxx__Stream__method__setDumpLine_0105', '__cxx__Print__method__getWriteError_00', '__cxx__Stream__method__println_010d', '__cxx__OneButton__method__tick_00', '__cxx__Print__method__setWriteError_0111', '__cxx__Print__method__setDumpLine_0105', '__cxx__Stream__init00', '__cxx__HardwareSerial__init0105', '__cxx__Stream__method__print_020505', '__cxx__Print__method__fixPrint_021205', '__cxx__HardwareSerial__method__print_010d', '__cxx__HardwareSerial__method__print_020a05', '__cxx__Stream__method__timedRead_00', '__cxx__Stream__method__print_021505', '__cxx__Stream__method__println_021105', '__cxx__HardwareSerial__method__print_01p0d', '__cxx__Print__method__print_021205', '__cxx__HardwareSerial__method__find_02p0d09', '__cxx__HardwareSerial__method__timedPeek_00', '__cxx__Stream__method__print_021105', '__cxx__Stream__method__find_02p0d09', '__cxx__HardwareSerial__method__read_00', '__cxx__Print__method__print_020505', '__cxx__Print__method__print_020905', '__cxx__Print__method__dumpPrint_02p0505', '__cxx__Print__method__println_021205', '__cxx__Stream__method__print_021205', '__cxx__Print__method__print_021605', '__cxx__Stream__method__findUntil_04p0d09p0d09', '__cxx__Print__method__println_00', '__cxx__HardwareSerial__method__timedRead_00', '__cxx__HardwareSerial__method__fixPrint_021105', '__cxx__Stream__method__fixPrint_021205', '__cxx__Print__method__println_020905', '__cxx__HardwareSerial__method__println_021205', '__cxx__Stream__method__readBytes_02p0d09', '__cxx__OneButton__method__setDebounceTicks_0111', '__cxx__Stream__method__find_02p0509', '__cxx__HardwareSerial__method__setDumpLine_0105', '__cxx__Print__method__println_021605', '__cxx__Print__method__print_021505', '__cxx__HardwareSerial__method__parseFloat_010d', '__cxx__Stream__method__readBytes_02p0509', '__cxx__Stream__method__print_021605', '__cxx__Stream__method__parseInt_010d', '__cxx__HardwareSerial__method__available_00', '__cxx__Stream__method__readBytesUntil_030dp0509', '__cxx__Stream__method__println_021205', '__cxx__HardwareSerial__method__print_021105', '__cxx__OneButton__method__attachDoubleClick_0165', '__cxx__HardwareSerial__method__println_021605', '__cxx__HardwareSerial__method__readBytesUntil_030dp0d09', '__cxx__Print__init00', '__cxx__Stream__method__print_010d', '__cxx__HardwareSerial__method__find_02p0509', '__cxx__Print__method__print_021105', '__cxx__Stream__method__findMulti_02prMultiTarget11', '__cxx__Stream__method__peek_00', '__cxx__Stream__method__setWriteError_0111', '__cxx__HardwareSerial__method__fixPrint_021205', '__cxx__Stream__method__setTimeout_010a', '__cxx__OneButton__method__setPressTicks_0111', '__cxx__OneButton__method__isLongPressed_00', '__cxx__HardwareSerial__method__find_010d', '__cxx__Print__method__println_020505', '__cxx__HardwareSerial__method__findUntil_04p0d09p0d09', '__cxx__HardwareSerial__method__write_0112', '__cxx__HardwareSerial__method__write_0111', '__cxx__Stream__method__print_01p0d', '__cxx__HardwareSerial__method__write_010a', '__cxx__HardwareSerial__method__print_021505', '__cxx__HardwareSerial__method__parseFloat_00', '__cxx__HardwareSerial__method__find_01p05', '__cxx__Stream__method__println_020a05', '__cxx__OneButton__method__attachLongPressStop_0165', '__cxx__Stream__method__clearWriteError_00', '__cxx__Stream__method__fixPrint_021105', '__cxx__HardwareSerial__method__findUntil_02p05p0d', '__cxx__HardwareSerial__method__print_020505', '__cxx__HardwareSerial__method__println_00', '__cxx__HardwareSerial__method__write_02p0509', '__cxx__HardwareSerial__method__readBytesUntil_030dp0509', '__cxx__HardwareSerial__method__write_0105', '__cxx__Print__method__print_020a05', '__cxx__HardwareSerial__method__write_0109', '__cxx__Stream__method__println_00', '__cxx__HardwareSerial__method__parseInt_010d', '__cxx__Stream__method__flush_00', '__cxx__HardwareSerial__method__println_020905', '__cxx__Print__method__println_021505', '__cxx__OneButton__method__setClickTicks_0111', '__cxx__HardwareSerial__method__dumpPrint_02p0505', '__cxx__HardwareSerial__method__print_021605', '__cxx__HardwareSerial__method__println_020a05', '__cxx__Stream__method__readBytesUntil_030dp0d09', '__cxx__Stream__method__find_01p0d', '__cxx__HardwareSerial__method__begin_010a', '__cxx__Stream__method__parseInt_00', '__cxx__HardwareSerial__method__println_021505', '__cxx__HardwareSerial__method__findMulti_02prMultiTarget11', '__cxx__HardwareSerial__method__print_021205', '__cxx__Stream__method__available_00', '__cxx__Print__method__println_021105', '__cxx__Stream__method__print_020a05', '__cxx__HardwareSerial__method__setTimeout_010a', '__cxx__Print__method__clearWriteError_00', '__cxx__HardwareSerial__method__flush_00', '__cxx__HardwareSerial__method__clearWriteError_00', '__cxx__Stream__method__println_020905', '__cxx__Stream__method__println_021505', '__cxx__OneButton__init021111', '__cxx__OneButton__method__attachClick_0165', '__cxx__HardwareSerial__method__findUntil_02p0dp0d', '__cxx__HardwareSerial__method__begin__0109', '__cxx__Print__method__write_02p0509', '__cxx__Print__method__println_01p0d', '__cxx__Stream__method__write_0105', '__cxx__HardwareSerial__method__peek_00', '__cxx__Print__method__println_020a05', '__cxx__HardwareSerial__method__find_01p0d', '__cxx__Stream__method__find_01p05', '__cxx__HardwareSerial__method__begin_00', '__cxx__HardwareSerial__method__println_01p0d', '__cxx__Print__method__println_010d', '__cxx__Print__method__print_01p0d', '__cxx__HardwareSerial__method__parseInt_00', '__cxx__OneButton__method__attachLongPressStart_0165', '__cxx__Print__method__fixPrint_021105', '__cxx__HardwareSerial__method__println_020505', '__cxx__HardwareSerial__method__println_010d', '__cxx__Stream__method__println_020505', '__cxx__Stream__method__println_01p0d', '__cxx__Stream__method__parseFloat_00', '__cxx__Print__method__write_0105', '__cxx__Stream__method__print_020905']
Switch_sdcpp_.cpp:806:1:error: uCxx:Can't find method __cxx__OneButton__method__attachDoubleClick_01p6f for object btn1 of class OneButton
uCxx returned error code:-1

This is my sketch code:

Code: Select all

#include <OneButton.h>

 // button pin number
#define BTN1_PIN     9 
#define BTN2_PIN     10 
#define BTN3_PIN     11
#define BTN4_PIN     12
#define BTN5_PIN     14
#define BTN6_PIN     15

// built in LED number
#define LED_PIN     13

// Button States
OneButton btn1(BTN1_PIN, true);  
OneButton btn2(BTN2_PIN, true);  
OneButton btn3(BTN3_PIN, true); 
OneButton btn4(BTN4_PIN, true);
OneButton btn5(BTN5_PIN, true); 
OneButton btn6(BTN6_PIN, true);

void setup() {
     Serial.begin(9600);
     pinMode(LED_PIN, OUTPUT);       
     pinMode(BTN1_PIN, INPUT_PULLUP);       
     pinMode(BTN2_PIN, INPUT_PULLUP); 
     pinMode(BTN3_PIN, INPUT_PULLUP);       
     pinMode(BTN4_PIN, INPUT_PULLUP); 
     pinMode(BTN5_PIN, INPUT_PULLUP);       
     pinMode(BTN6_PIN, INPUT_PULLUP);
     Serial.println("Starting TwoButtons..."); 

     // link button 1 functions
     //btn1.attachClick(click1);
     btn1.attachDoubleClick(doubleclick1);
     btn1.attachLongPressStart(longPressStart1);
     btn1.attachLongPressStop(longPressStop1);
     btn1.attachDuringLongPress(longPress1);
  
     // link button 2 functions
     //btn2.attachClick(click2);
     btn2.attachDoubleClick(doubleclick2);
     btn2.attachLongPressStart(longPressStart2);
     btn2.attachLongPressStop(longPressStop2);
     btn2.attachDuringLongPress(longPress2);
  
}

void loop() {
   // keep watching the push buttons:
  btn1.tick();
  btn2.tick();

  // You can implement other code in here or just wait a while 
  delay(5);
}

// ----- button 1 callback functions

// This function will be called when the button1 was pressed 1 time (and no 2. button press followed).
void click1() {
  Serial.println("Button 1 click.");
} // click1


// This function will be called when the button1 was pressed 2 times in a short timeframe.
void doubleclick1() {
  Serial.println("Button 1 doubleclick.");
} // doubleclick1


// This function will be called once, when the button1 is pressed for a long time.
void longPressStart1() {
  Serial.println("Button 1 longPress start");
} // longPressStart1


// This function will be called often, while the button1 is pressed for a long time.
void longPress1() {
  Serial.println("Button 1 longPress...");
} // longPress1


// This function will be called once, when the button1 is released after beeing pressed for a long time.
void longPressStop1() {
  Serial.println("Button 1 longPress stop");
} // longPressStop1


// ... and the same for button 2:

void click2() {
  Serial.println("Button 2 click.");
} // click2


void doubleclick2() {
  Serial.println("Button 2 doubleclick.");
} // doubleclick2


void longPressStart2() {
  Serial.println("Button 2 longPress start");
} // longPressStart2


void longPress2() {
  Serial.println("Button 2 longPress...");
} // longPress2

void longPressStop2() {
  Serial.println("Button 2 longPress stop");
} // longPressStop2
Am I doing something wrong? Or is this error related being incompatible with the Z-Uno? I use this library on my other Arduino's all the time. But I know that the Z-Uno has a more limited cpu package, so maybe that has something to do with it? Also I've commented out the attachClick function, but it gives me the same error on that function as well.

Post Reply