[SOLVED] Button Problems

I have a two pin pbs, one pin plugged into PWM 5 (have tried others) and the other to ground. Using Arduino DUE.

const int BUTTON = 5;

void setup() {
  // put your setup code here, to run once:



void loop() {
  // put your main code here, to run repeatedly:

  if(digitalRead(BUTTON == LOW)){

    Serial.println("Button is depressed!");


This is not Serial.print-ing "Button is depressed" (or anything else), yet the multimeter reads the pin changing voltage when I press the button... Not sure what I'm doing wrong here.

Thank you.

Does pinMode(pin,INPUT); followed by digitalWrite(pin,HIGH) work on the Due the same way that it does on an AVR-based Arduino? I'm not sure it does...

Try doing pinMode(pin,INPUT_PULLUP); as is recommended.

Still doesn't work. But thanks anyways. Any other ideas?

P.S. I said the multimeter was reading correctly.

if(digitalRead(BUTTON == LOW)){


if(digitalRead(BUTTON) == LOW){

There's the problem. Thank you!