error: 'longPress' was not declared in this scope exit status 1

Hello,

this is the code i’m dealing with:

#include <LiquidCrystal.h>
#include <OneButton.h>

OneButton button(A3, true);
LiquidCrystal lcd(12,11,5,4,3,2);


void setup() 
{
  lcd.begin(16,2);
  
  button.attachClick(click);
  button.attachDoubleClick(doubleclick);
  button.attachDuringLongPress(longPress);
}


void loop() 
{
  button.tick(); //keep watching the push button:
  
  lcd.setCursor(0,0);
  lcd.print("-Engineering R.-");
  
}
  
void click()  //This function will be called when the button is pressed 1 time.
{
  lcd.setCursor(0,2);
  lcd.print("Button - 1 click.");
} 

void doubleclick() //This function will be called when the button1 was pressed 2 times in a short timeframe.
{
  lcd.setCursor(0,2);
  lcd.print("Button - 2 clicks.");  
} 

void longPressStart() //This function will be called once, when the button1 is pressed for a long time.
{
  lcd.setCursor(0,2);
  lcd.print("Button - long press start."); 
} 

void longPressStop() //This function will be called once, when the button1 is released after being pressed for a long time.
{
  lcd.setCursor(0,2);
  lcd.print("Button - long press end."); 
}

After trying to verify it, I get an error that says (error: ‘longPress’ was not declared in this scope

exit status 1)

Any help would be awesome!

I’m a newbie and so I “followed” an example that was provided with the OneButton library. Not 100% sure whats going on…

Thanks,
Yann

You don’t have a function called longPress. You have one called longPressStart and one called longPressStop. But you don’t have one called longPress. So the compiler is right. You’re asking for a function that doesn’t exist.

Oh, I see it now.

Thank you Delta_G