per1234 / PalatisSoftPWM

Software PWM library for Arduino
BSD 3-Clause "New" or "Revised" License
17 stars 5 forks source link

SoftPWM.begin() causes inverted channels to flash LOW #1

Closed per1234 closed 8 years ago

per1234 commented 8 years ago

All pins defined as channels using SOFTPWM_DEFINE_CHANNEL_INVERT momentarily go LOW when SoftPWM.begin() is called. The reverse is not true with SOFTPWM_DEFINE_CHANNEL.

Palatis commented 8 years ago

call allOff() in begin()?

I didn't really test invert mode since i have a HIGH = LED ON setup.

per1234 commented 8 years ago

call allOff() in begin()?

That fixed it, thank so much Palatis! It took me a bit of testing to realize that the flash is only visually noticeable when there are a lot of PWM channels defined. I initially only had one channel in my test sketch and was starting to think I had imagined the issue. I have 15 channels on a MCU running at 8 Mhz on my actual device so it's obvious there.