0

In the NodeMCU doc, it appears PWM on a pin may be set one of two ways, either through PWM or GPIO.

In the PWM doc it says that if you set PWM on one pin for a certain frequency then that frequency is set for all other pins using PWM. This means that you don't have RGB but rather 50 shades of grey.

The GPIO section does not mention this limitation. Is it on place? Is there only one timer on the chip itself available for PWM?

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
cc young
  • 18,939
  • 31
  • 90
  • 148

1 Answers1

2

You seem to be confusing the effects of Frequency and Duty cycle on an RGB led, you will have 3 pins connected on which you generate a PWM, where you can set the duty cycle to change the intensity, whether all those frequencies are the same or not doesn't matter.

Cakes
  • 108
  • 7
  • indeed. will test. – cc young Sep 28 '16 at 08:13
  • It's probably using a software PWM generator, which is why it can be dynamically assigned, it doesn't have hardware PWM pins as far as I'm aware. The PWM generator source is sharedover pins as to not waste processing power, thus you can only set the source for a singular "timer". – Cakes Sep 28 '16 at 08:46
  • Unclear to me from doc. Is intensity the duty cycle / 1024, or the duty cycle / the frequency? – cc young Sep 28 '16 at 09:48
  • to answer my on question from experimentation: intensity = duty cycle / 1024 – cc young Sep 28 '16 at 10:54