multiple PwmOut pins

Home Forums mDot/xDot multiple PwmOut pins

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11963
    Gavin Perry
    Participant

    Does the mdot mbed support multiple PwmOut channels?
    I’d like to set up 4 channels (RGBW) like this:

    #include “mbed.h”
    PwmOut ledR(PA_8);
    PwmOut ledG(PA_9);
    PwmOut ledB(PA_12);
    PwmOut ledW(PA_11);

    //I’m ok with them all sharing the same timer/period.
    ledW.period_ms = 2;
    //Then set the color fraction as needed
    ledR = 0.01f;
    ledG = 0.3f;
    ledB = 0.4f;
    ledW = 0.0f;
    //(more programatically of course sending colors from the Conduit…

    #11964
    Mike Fiore
    Blocked

    Gavin,

    PeripheralPins.c in the mDOt platform support lists all the pins that are PWM capable.

    https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_MTS_MDOT_F411RE/PeripheralPins.c

    I did some reading on this and it sounds like pins that are run by the same timer must have the same frequency, but each can have a different duty cycle (just FYI since you said you were OK with this).

    PA_12 is not listed as a PWM capable pin, so you’ll need to find a replacement for that one.

    Hope this helps!

    -Mike

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.