User:Fabbari/sandbox

ESP-12E ESP8266 Serial WiFi Board

RGB Led PWM Configuration
The RGB LED is connected to the d6, d7 and d8 data lines.

To setup and use the PWM module in NodeMCU to change the colors, the example setup would be changed as follows:

pwm.setup(6, 500, 512) pwm.setup(7, 500, 512) pwm.setup(8, 500, 512)

pwm.start(6) pwm.start(7) pwm.start(8)

function led(r,g,b) pwm.setduty(6, g)   pwm.setduty(7, b)    pwm.setduty(8, r)  end

Now the led function can be used to setup the RGB LED values:

led(512, 0, 0)    -- Red led(0, 512,0)     -- Green led(0, 0, 512)    -- Blue led(512, 512, 512) -- White led(0,0,0)        -- Off