rudy wrote:PWM = 0 most likely does not produce a constant 0 output. I expect you are seeing the minimum output which could be one pulse time. This quirk is typical with hardware PWM, but I thought that the PWM on the ESP8266 was done in software so I would thing that case could be handled.
Indeed. The PWM is made by software as far as i know. So that should not be a problem. But i have tried the approach above an that's working.