Author Topic: Digispark only supports PWM on pins labeled p0, p1 and p4?  (Read 154 times)

bulrush

  • Newbie
  • *
  • Posts: 7
New Digispark and new forum user here! I'm new to programming boards and am using the Arduino IDE 1.8.2. I successfully got the onboard LED to light using a pin value of 1.

I have a Digispark with microusb port. I'm trying to light LEDs using analogWrite(). I just found out that analogWrite() is for doing PWM. So PWM can only be used on pins labeled p0, p1, and p4?

I need to light at least 4 LEDs via PWM. How many pins on the Digispark Pro can be used with PWM? The DSPro has more pins.

Thank you!.

KASA

  • Newbie
  • *
  • Posts: 29
Re: Digispark only supports PWM on pins labeled p0, p1 and p4?
« Reply #1 on: May 22, 2017, 01:31:45 pm »
Yes, only P0, P1 and P4 can d  HARDWARE PWM but you can use software PWM (lower frequency) on all of them.
https://digistump.com/wiki/digispark/tricks#software_pwm

PeterF

  • Hero Member
  • *****
  • Posts: 783
Re: Digispark only supports PWM on pins labeled p0, p1 and p4?
« Reply #2 on: May 28, 2017, 07:41:41 pm »
Since you asked about the Digispark Pro, tt looks like you can use PWM on up to 7 pins: http://digistump.com/wiki/digispark/tutorials/pinguidepro

But depending on your needs, as KASA pointed out, TinySoftPWM exists to provide a slower emulated PWM and allows you to use all of the pins.