Very useful information, thanks
You know, as a matter of fact I only use serial.print as a "console", when something doesn't work I print variables to see where the program works differently than I expected, ultimately I won't need serial.print. Even though I managed to solve this in a different way it still bothers me why it worked before even with Serial.print, a digital device is a zero one device, it's governed by some rules that don't change so it's hard to explain with fart.
Second question is do you know of any microcontrollers with wifi at a similar price but with more working pins that I don't have a problem with, is this kind of esp + pfc the best arrangement? I want to fit the whole project in as small a box as possible so I don't want something the size of an arduino leonardo
.
I also know that I could theoretically hook up an arduino nano, mini under I2C and have a lot more pins that will in addition handle encoder or other devices without putting a strain on my esp, but that's firstly extra cost, secondly space.

Second question is do you know of any microcontrollers with wifi at a similar price but with more working pins that I don't have a problem with, is this kind of esp + pfc the best arrangement? I want to fit the whole project in as small a box as possible so I don't want something the size of an arduino leonardo

I also know that I could theoretically hook up an arduino nano, mini under I2C and have a lot more pins that will in addition handle encoder or other devices without putting a strain on my esp, but that's firstly extra cost, secondly space.