"0-10volt" and "ledChannel" in your code suggests you want to control a LED driver.
Is this a MeanWell driver?
Then just connect collector to DIM+ and emitter/ESP grouund to DIM-
NO 12volt supply, NO collector resistors, NO cap.
A single transistor is usually not a very good way to convert PWM to 0-10volt.
Better to convert ESP 3.3volt PWM first to 0-3.3volt DC with an RC filter, and then amplify it with an opamp three times to 0-10volt.
Or use a PWM to 0-10volt breakout board from ebay.
Does the other thread say what PWM frequency that circuit is designed for?
The circuit is designed to operate at a specific frequency.
For what controller was it designed? A 5V or 3V3.
If 5V then 3V3 is possibly not producing the base current to saturate the transistor, the fact that 255 will no give you 0V, means that the transistor is not being turned fully ON.
Have you got an oscilloscope? If so, put it on the output pin of the Arduino and see what the waveform looks like with various values sent to ledcWrite. By the way, the output voltage should fall as you increase the value.
For the ESP8266, the default 'analogWrite' range is 1023, not 255 like the other Arduino. I haven't used ESP32 but you can try adding the 'analogWriteRange (255)' command in the 'void setup ()' - for ESP8266 its works.