-->
Page 1 of 1

howto: pwm(): Setting output to open drain (collector)

PostPosted: Thu Jun 29, 2017 8:35 am
by MarkusF
Hi Team,
I am using a LED driver (dc-dc) with pwm modulation, which has its own pull up resistor at the pwm input,
resulting in the requirement to just pull down the signal, without active high.
Trick: In file esp8266\hardware\esp8266\VERSION\cores\esp8266\core_esp8266_wiring_pwm.c,
function extern void __analogWrite(uint8_t pin, int value) { ...
change line:
pinMode(pin, OUTPUT);
to
pinMode(pin, OUTPUT_OPEN_DRAIN);