Crazy buttons.

I am working with an arduino DUE with industrial servo motors.

I need to attach 6 buttons, the problem is, sometimes these buttons activates himself alone (blink). Why it could be? The fact that it's working in a hard enviorment?

Also, to activate the buttons, I need a pull-down, so I implemented via software a !pullup.

pinMode(B1, INPUT_PULLUP);

Joystick.state.buttons.b00 = !digitalRead(B1);

Is it right? or is it silly? Should be better craft an phisical pull-down with a correct resistor? I don't know how INPUT_PULLUP works inside a DUE.

I would appreciate any help, thanks.

If your switch is activated randomly, hook a pull-down resistor to avoid EMI (VCC is 3.3V for a DUE):

Next is the debouncing issue:
https://forum.arduino.cc/index.php?topic=138887.0

Ok, I implemented a physical pull-down and now it works perfect.

Thanks.