Is the analogWrite Implementation of PICO hardware or ISR based?

hello,

Im using the arduino IDE to program the pico and would like to know if the analogwrite is done via hardware or is being done ISR way,

I would also like to change the PWM frequency but i dont think arduino core has that function?

am i just stuck, have to use 3rd party libraries?

Yes it is.
The PWM is also capable of being produced by the PIO pins as a state machine.

Changing the PWM frequency is possible.

See
https://www.codrey.com/raspberry-pi/raspberry-pi-pico-pwm-primer/

The guide is in python though, i need to do it in the arduino IDE. kinda stuck with arduino IDE as the libraries on some portion of my setup is only arduino compatible :slight_smile:

If you'd just like to use PWM for RP2040, try these libraries of mine

  1. RP2040_PWM
  2. RP2040_Slow_PWM

It seems that you're start moving into RP2040, it's better to have a look at and see that there are already many libraries to support RP2040

Your library examples are in category of UNSUPPORTED in the arduino examples tab.

I am also having a hard time , so the duty cycle parameter what is the value range? 0- 100 because it seem to have a double data type

Your library examples are in category of UNSUPPORTED in the arduino examples tab.

Will fix in next release of some libraries. As you use mbed_rp2040 core, the slow PWM library to use is MBED_RP2040_Slow_PWM

If the library's examples are not shown or shown as UNSUPPORTED , move down to the INCOMPATIBLE list of examples or open directly from the libraries folder

I am also having a hard time , so the duty cycle parameter what is the value range? 0- 100 because it seem to have a double data type

It's double, so you can use from 0.000-100.000 to have better precision.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.