OR operator problem

In this program, the amplitude adjustment occurs using two  buttons on  PB6 and  PB 9 (up /down) , PB12 is the speed button (slow/fast)
Pressing just PB6 or PB9 regulation is slow, when additionally is pressed  button PB 12 after 2 sec.  the regulation is fast. 
How to make the speed change when the button 6 or 9 is pressed for more than 2 seconds ?

int LED1 = PB15;
int LED2 = PC13;
int button = PB12;

boolean LED1State = false;
boolean LED2State = false;

long buttonTimer = 0;
long longPressTime = 250;
//long longPressTime = 1000;

boolean buttonActive = false;
boolean longPressActive = false;

void setup() {

 pinMode(out2, PWM);
 pinMode(ampp, INPUT_PULLDOWN);
 pinMode(ampn, INPUT_PULLDOWN);
pinMode(LED2, OUTPUT);
 pinMode(button, INPUT_PULLDOWN);

 if (digitalRead(button) == HIGH)
   // if (val == HIGH)

Which Arduino board are you using ?


Vik321: STM32

Not exactly an Arduino is it?

It is ARM,

This is working

if (digitalRead(ampn) == HIGH)

and this also

if (digitalRead(ampp) == HIGH)

not working together a

if (digitalRead(ampp||ampn) == HIGH)


if (digitalRead(ampp | ampn) == HIGH)
if (digitalRead(ampp) == HIGH || digitalRead(ampn) == HIGH)

Or just:

if (digitalRead(ampp) || digitalRead(ampn))

Please post a complete program that compiles without errors.

JCA79B: if (digitalRead(ampp) == HIGH || digitalRead(ampn) == HIGH)

Or just:

if (digitalRead(ampp) || digitalRead(ampn))

Thanks = it is working