Shop OBEX P1 Docs P2 Docs Learn Events
Pulse/direction counting — Parallax Forums

Pulse/direction counting

To increment/decrement a counter based on the high/low state of another input; is there a smartpin mode for doing this or would it need to be coded?

Comments

  • AribaAriba Posts: 2,682

    I think mode %01101 is exactly what you want:

    %01101 = Accumulate A-input positive edges with B-input supplying increment (B=1) or decrement (B=0)
    

    The predefined constant for that mode: P_REG_UP_DOWN

  • Outstanding!!!!

    Many thanks again, Andy :+1: This P2 is a dream-come-true :smile:

Sign In or Register to comment.