6 Replies Latest reply on Oct 2, 2015 8:21 PM by user_342122993

    Passing pins to a function

    alfredo.sandoval

      Hi, does anyone know how to pass a pin to a function? For example, i've created a function called PulseIn() which will behave similar to the arduino function PulseIn() which measures the amount of time for which a pin is high. However, right now I'm only limited to use it with a single pin. I want to expand it to be more flexible where I can pass the pin to the function and it will do its thing based on the desired pin.

         

       

         

      Ex: int duration = PulseIn(pinName);

         

       

         

      The duration of the pulse for the pin "pinName" will be saved to the int variable duration.

         

       

         

      thanks!