This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Multiple outputs act in unison

Is there a way to have 6 different GPIOs act in unison off one event/action?  I need all 6 to go ON and OFF at EXACTLY the same time based of an event or action.

Parents
  • Hi Brian

    The easiest way to do this is to write directly to the OUT, OUTSET or OUTCLR registers in the GPIO module. The last two in particular makes it very easy to set or clear multiple pins at the same time, simply by writing a pin mask into the register. 

    As an example, this code sets P0.02 and P0.05 at the same time:

    NRF_GPIO->OUTSET = (1 << 2) | (1 << 5);

    Best regards
    Torbjørn

Reply
  • Hi Brian

    The easiest way to do this is to write directly to the OUT, OUTSET or OUTCLR registers in the GPIO module. The last two in particular makes it very easy to set or clear multiple pins at the same time, simply by writing a pin mask into the register. 

    As an example, this code sets P0.02 and P0.05 at the same time:

    NRF_GPIO->OUTSET = (1 << 2) | (1 << 5);

    Best regards
    Torbjørn

Children
No Data
Related