Shop OBEX P1 Docs P2 Docs Learn Events
Read the data using Smart Pin — Parallax Forums

Read the data using Smart Pin

Hello @JonnyMac and @evanh , Can you please help me to know how to define propeller 2 any pins as smart pin and how to read the data using smart pins. I need one simple example to know this mechanism.

Comments

  • evanhevanh Posts: 16,015

    Looking at Eric's manual on Flex Basic I see PINSTART for configuring a smartpin and RDPIN for reading a smartpin's Z register. And of course there is also WRPIN/WXPIN/WYPIN for component writing to a smartpin.

    The mechanism is the same as with Spin or C. Eg: (My Basic is rusty so excuse any syntax errors)

    pinstart 25, P_QUADRATURE | P_PLUS1_B, 0, 0   'Encoder inputs on P25 and P26
    
    while 1
            print "counter = ";_rdpin(25);"  ";chr$(13)    'display the encoder count
    wend
    
Sign In or Register to comment.