ESP8266 Pins have stopped working

Hey all,

I have a ESP8266 which was working perfectly fine with my code which switched pins on and off through a web request. But one day it just stopped working. So then I uploaded a blinky code to see if I can make it work, but it doesn't.

I've pulled my hair out, but can't find what's wrong and it definitely used to work. But just in case I'm missing something, can someone please confirm my code is correct and expected to blink on Pin 1 as well as the builtin?

I can see the builtin light works fine, but D1 does not. The serial output or digitalRead returns an empty variable.

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(D1, OUTPUT); 
  digitalWrite(D1, LOW);
  Serial.begin(115200);
}

void loop() {
  digitalWrite(D1, HIGH);
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.println("On State:" + digitalRead(D2));
  delay(1000);
  digitalWrite(D1, LOW);
  digitalWrite(LED_BUILTIN, LOW);
  Serial.println("Off State:" + digitalRead(D2));
  delay(1000);
}

what esp8266 board you have a what do you select in Tools menu?

I selected the Wemos D1 R2 & mini option in the menu. The Generic ESP8266 Module also seems to generally work with this one.

The chip only has D1 Mini embossed on it.