Shop OBEX P1 Docs P2 Docs Learn Events
Identifying a the cog id of the rotary encoder cog — Parallax Forums

Identifying a the cog id of the rotary encoder cog

tbriggstbriggs Posts: 9
edited 2008-08-08 00:43 in Propeller 1
Sorry for the earlier post. I forgot the subject.....

I am trying to use the rotary encoder cog and would like to stop it and start it but do not know how to identify the cog id.

Any help would be appreciated.

Thanks!

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-08-07 23:49
    I deleted your other post for you, in the future you can edit a post by clicking on the pencil icon in the upper right hand corner of your post.

    Take care,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-08 00:37
    The only way to find out the cog's id is to save it when the cog is started with a COGNEW. I don't have the rotary encoder object's code handy, but there's probably some kind of start method that saves the cog # in an internal variable. Usually there's a stop method as well. If so, you just need to call that stop method and it'll refer to the saved cog # and stop the cog. If not, you'll have to look at the start routine and possibly save the cog # yourself, perhaps by modifying the start routine to return the cog # to your own program where you can save it for a later cogstop.

    There is a 2nd way to get the id and that is for the actual running cog to do a COGID and save the number somewhere where your cog can refer to it. I suggest this first method though. It's easier.
  • Richard S.Richard S. Posts: 70
    edited 2008-08-08 00:43
    I have done this in a Digital Readout Program listed on the forum.· I clipped out some pieces to demonstrate my method.· I used the encoder stop and restart to allow me to zero the encoders or preset an encoder value.· For the complete listing search under 'Quad DRO'.

    See attachment.





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Richard in Michigan
Sign In or Register to comment.