Don't know the version of esp 8266 IDE you have installed. Depending on that "INPUT" either behaves as tristate or pullup.
in general, I would not wonder about not functioning at all, since you never pul lthe chargePin high
so I would suggest to modify the source a littel e.g.:
const int chargePin = 14;
const int drainPin = 12;
unsigned long chargeTime = 0;
void setup() {
pinMode(chargePin, INPUT);
pinMode(drainPin, INPUT);
Serial.begin(115200);
delay(10);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
unsigned long cycleStart, cycleStop;
// drain cap first best via both pins
pinMode(drainPin, OUTPUT);
pinMode(chargePin, OUTPUT);
digitalWrite(drainPin, LOW);
digitalWrite(chargePin, LOW);
Serial.print(micros()); Serial.print(" - ");
Serial.println("Discharging...");
delay(9000);
digitalWrite(chargePin, HIGH); // prepare charging yet not possible because drainPin still low
cycleStart = micros();
pinMode(drainPin, INPUT); // now start really by tristating drainPin
Serial.print(cycleStart); Serial.print(" - "); Serial.println("Charging!!!");
Serial.println(digitalRead(drainPin));
while (digitalRead(drainPin) == 0) {yield();};
cycleStop = micros();
chargeTime = cycleStop - cycleStart;
Serial.print(cycleStop); Serial.print(" - "); Serial.print("Done...");
Serial.print(chargeTime);
Serial.println("ms");
delay(1000);
}