Shop OBEX P1 Docs P2 Docs Learn Events
The rotary encorder pin connections? — Parallax Forums

The rotary encorder pin connections?

The jonnymacs beginner series 2 , the encoder has 5 pins.
There are no directions how to connect them to the P2 Edge.

Thins are 1. Ground
2. + --> 5v OR 3.3v
3.SW -
4.DT
5.CLK
Thank you,
Siri

Comments

  • If you look at the Jonny Mac jm_quadrature_test for P2 its ENC A=40, ENC B=41, and SW=42
  • Hmmm... I posted a response to this earlier, but it seems to have disappeared (2021 striking, already?)

    I don't like using "magic numbers" for pins, so they're always defined in my apps.

    In the version I'm running...
    con { app io pins }
    
      ENC_BTN  = 18  { I }                                          ' active-low encoder connections
      ENC_B    = 17  { I }                                          ' encoder data
      ENC_A    = 16  { I }                                          ' encoder clock
    
    This is the beauty of named constants -- we only have to change them in one place. Note that ENC_BTN is the SW connection on the encoder.

    I also like to use specific colors when wiring:
    -- Black for Ground
    -- Orange for 3.3V (Red for 5.0V)
    -- Blue for the SW pin
    -- Yellow for the DT pin
    -- White for the CLK pin

Sign In or Register to comment.