Do I put the button on + or -?

Hi,

I know this isn't really Arduino-related, as I'm using a ESP8266 with CH320G.
Here's my code:

const int LED = D7;
const int button1 = D1;
const int button2 = D2;
void setup() {
  pinMode(LED, OUTPUT);
  pinMode(button1, INPUT_PULLUP);
  pinMode(button2, INPUT_PULLUP);
}
void loop() {
  if(digitalRead(button1) == 0 ){
    digitalWrite(LED, LOW);
  }
  if(digitalRead(button2) == 0 ){
    digitalWrite(LED, HIGH);
  }
}

Do I put the buttons to make contact from + or - to their pins?

Thanks

Connect the buttons from the pins to ground.

It's more correct to put

if(digitalRead(button1) == LOW )

because on this page

it says

Returns
HIGH or LOW

Keep the INPUT_PULLUP setting, which will have D1 as HIGH when the button is NOT pressed

Change the "if" condition from 1 to 0 (HIGH is NOT pressed, LOW is PRESSED).

Wire your button from the PIN to the open side of the BUTTON to GROUND.

+---------+
|       D1|--|BUTTON1|-+
|         |            |
|         |            |
|      GND|------------+
+---------+

When the button is pressed, the state of D1 will change from HIGH (not pressed) to LOW (pressed).