Port D3 esp8226

Hi, i use for the first time the nice ESP8226 and the 1-ButtonShield button

I managed to turn on the integrated LED on the board, but if I try to control it via the button (through port D3) it doesn't work

Could you help me with a suggestion, I searched for information on the internet but I didn't find anything that would help me so far

This is the code I wrote

static const uint8_t D3 = 0;

const int buttonPin = D3;
const int ledPin = LED_BUILTIN;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}

void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}

Does it have to include a button library?

Which ESP8266 board do you have?

Which board do you have selected from the Tools > Board menu?

How is your button wired? Do you have a pulldown resistor connected to pin D3?

INeedHelp98:
Does it have to include a button library?

No.

I selected "Generic ESP8266 Module"

The button connection is the same as in the video

do you have a Wemos D1 mini?
is the button on io 0?
why do you define io 0 as D3? If you have the Wemos, then select it in Tools and Dx constants will be defined.

io 0 is a boot configuration pin. it must have a pull-up at boot to start the esp8266 in normal mode.
if you wire a button to that pin, the button should be wired to ground on the other side. the if the button is pushed down the digitalRead returns LOW (again down is LOW). If the button doesn't connect the pin to ground, the pull-up holds the pin HIGH.