void loop(){
if(digitalRead(encoderPbsPin)){
//button is not being pushed
}else{
//button is being pushed
}
What rubbish formatting.
void loop()
{
if(digitalRead(encoderPbsPin))
{
//button is not being pushed
}
else
{
//button is being pushed
}
}
is a hell of a lot easier (for me) to read, and to understand where to add code.
If you want to display the encoder reading when the switch is not being pressed, the comment surely provides a clue where to put code to do that.
While it might have been easy to explain why there were 2 delay(), you have not explained why you have ANY delay().
long lastencoderValue = 0;
Variable names are supposed to use camelCase. Your camel is missing a hump.