- 24 -
To use PWM on the D1 Mini module (ESP8266) the same function as on
Arduino boards is used:
analogWrite(pin, value)
where pin is the name of GPIO pin, any free GPIO pin of the D1 Mini module.
The value is the duty cycle, a value between 1 and 1023.
Do not use number zero for value, because it turns OFF the PWM function
on a specific pin!
Closer to the value zero the higher brightness level of a LED is and closer to
the value 1023 the lover brightness level of a LED is.
To make the LED to fade, the while(1) loop inside the loop() function has to be
used, or else it will not work.