Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26
  1. #11
    10+ Posting Member
    Join Date
    Apr 2011
    Location
    Netherlands
    Posts
    10
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Thanks for switching me on to Keith Neufeld's code. So effective and so simple! Works great with 'El Cheapo' rotary encoders on eBay from Sure Electronics.

  2. #12
    150+ Forum Groupie
    Join Date
    May 2006
    Location
    london england
    Posts
    195
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Hi Guys , have to admit it im stumped D'oh --- Got all the code working as individual test programs ref Encoders and the like but have come right royally unstuck in my ability to create the required Ardunino PDE . i realise that jim has done the hard work and that various other code snippets have been published here in the forum topic but cant seem to get my head around how to use the encoder routine within the Link2FS demo PDE --- i have come to the conclusion that making bits is easier than coding software gimme a diagram sketch or a thought and i'll make it, gimme code im stumpped -- not looking for the whole soloution , but can anyone post a sample snippet of arduino code to allow me to set up my encoders for Increamenting and decrementing the in focus data to be displayed on the LCD --- have gotten Keith encoder routine to work as jim described and can clearly see on the serial monitor the value changing from 1 to -1 reliably and repeatedly dependant on direction of rotation so thats sorted , i may well be making hard work of a simple thing but at the moment its not sinking into the grey matter... my train of corrupt thought goes like this ,, select in focus frequency ( Nav - Com etc ) - scan encoder for state change - if clockwise or anti clockise change seen then send code to arduino - designated keyboard event code then sent to FSX - LCD updated to new value - repeat loop ?? got a couple of days off soon and would like to crack on with this so i can post some genuine project updates

  3. #13
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    763
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Yes we better get some PDE's out there to give people "demo's" of this and that.
    It all takes time tho and I' still flat out at work ,,, it just goes on and on !!!!

    Have a read of this post ,,,,,

    http://www.mycockpit.org/forums/show...in-Arduino-1-0

    It spells it all out.

    Cheers ,,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  4. Thanks wannabeaflyer thanked for this post
  5. #14
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    763
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Hi Guys ,, Some Guys were having trouble integrating the rotary encoder thingy into their projects so I've done a wee help file consisting of including a rotary encoder into my "Demo" PDE's.

    It's available here ,,,,
    www.jimspage.co.nz/rotary_encoder_help.zip

    Hopefully it might "unstick" some coders out there.
    Cheers ,,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  6. Thanks wannabeaflyer thanked for this post
  7. #15
    150+ Forum Groupie
    Join Date
    May 2006
    Location
    london england
    Posts
    195
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Yesss Yesssss and more yess LOL, dam i was close but no cigar as they say --- here it comes massive thanks once again , talk about just what the doctor ordered .. Jim you have done me a great favour and i thank you for it ... could not see the wood for the trees and went off on the wrong track trying to get this sorted , you and the other guys here are stars , now i can press on and follow your lead in making my own Cockpit modules . hope to have some thing posted very soon now .. let part 2 of the fun begin

  8. Thanks Jim NZ thanked for this post
  9. #16
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    763
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Whoops ,, there's a typo in the "pde_inout_v1_1re.pde"
    The code is correct ,, but the comments had a mistake in them (so much for copy and paste )

    Where it say's ,,
    Quadrature quad1(8, 9); //added .. the RE is connected to pins 2 and 3
    // Make sure the "push" switch is connected to pin 4
    Should read ,,,
    Quadrature quad1(8, 9); //added .. the RE is connected to pins 8 and 9
    // Make sure the "push" switch is connected to pin 10

    The mistake is rather obvious but still needs corrected. (Sorry guys).

    I have corrected this in the download so if it didn't make sense ,, download it again and all will be well.

    Thanks for the comments Wannabe ,,, only too glad to help. Rest easy tho as you weren't the only one having trouble.

    See ya's ,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  10. #17
    25+ Posting Member



    Join Date
    Dec 2010
    Location
    Newnan, Ga.
    Posts
    65
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Hello all,

    I have been trying to connect, without success, a CTS 288T232R161A2 rotary encoder to a mega arduino board using keith's quadrature library and sketch. I have succesfully connected the ELMA E37 half cycle encoders. I realize the CTS encoders I ordered are quarter cycle and that appears to be the problem because I do not see where the sketch can be changed to properly recognize quarter cycle encoders, 16 detents, 4PPR. Well at least my attempts to get them to operate properly have failed. I can get them to send a signal every other detent, every 4th detent and even every 8th detent but so far not every detent.

    Is there another script that I can enter into the sketch that will allow me to use the quarter cycle encoders with the arduino?

    It appears I will need to purchase some more encoders and would like suggestions on which model numbers otheres have used with good results. I would like to stay in the 20 PPR.

    Yes, I am just starting off with the arduino, Link2FS and writing code. I have a very limited understanding of code but I learning each time I sit down.

    Thanks

    Robert

  11. #18
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    763
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    You seem to be just about there Robert.

    In the PDE there is a line (or something like it) like ,,,

    long X1 =(quad1.position())/2; // divide by 2 for half cycle encoders

    Remember anything after // is just comments.

    Looking at the "/2" ,,

    Have you tried removing it (the /2) ??
    or replacing the /2 with /4
    or replacing the /2 with /8

    I presume you have to get what you have done so far ,, but which one's produced what ??

    Lets know ,,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  12. #19
    10+ Posting Member
    Join Date
    Feb 2011
    Location
    Williamson, GA, USA
    Posts
    23
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Hi Jim, I am working on the same thing at the same level and have tried using the "/2" AND "/4", But think I seen the "/2" came before the last ")" ex, long X1 =(quad1.position()/2); // divide by 2 for half cycle encoders. Just wondering if that makes any diff as it seems to me it would. Thanks, Lee
    We were meant to fly, even with a computer.

  13. #20
    25+ Posting Member



    Join Date
    Dec 2010
    Location
    Newnan, Ga.
    Posts
    65
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Thanks Jim,

    I have been experimenting with the encoders and PDE for a while now. Most of my issues were self imposed.

    Good question and I should have provided more information on my first post. What have I tried till now?

    All the reading I have done about Keith's quadrature I have not seen a mention about working with a quarter cycle encoder. I have seen half and full cycle encoders. I did see where your web page mentiuons quarter cycle encoders.

    I have tried the following while using serial monitor to view the pulse.

    long X4 =(quad4.position()); // for half cycle encoders This script provided me with a pulse on every other detent.
    if (X4 != Xold4) {
    if (X4 > Xold4) {Serial.print("D780");}
    if (X4 < Xold4) {Serial.print("D790");}
    Xold4 = X4; // overwrites the old reading with the new one.
    }//end of quad4 read

    For now on I will just paste the first line as that is all I am changing.

    long X4 =(quad4.position())/2; // for full cycle encoders. The /2 for full cycle encoders provided me with pulse every 4th detent. Except when reversing direction where the pulse would come on the second
    pulse then every fourth pulse.

    long X4 =(quad4.position())/4; // experimental. This provided a pulse on every 8th detent except when reversing direction. First pulse would happen on 2nd detent then back to 8 detents.

    At this point I can see what is happening and all thioough I do not understand the details I can see that as I continue to incease the /2 it would require more detents to get a pulse.

    /4 = 8
    /8 = 16
    and so on....

    So I think maybe I need to go lower with the diviser. I do not know if that would work or not but at the time its worth a try.


    long X4 =(quad4.position())/.50; // experimental. This provided a pulse every other detent. Its getting back closer to 1 pulse per detent.

    long X4 =(quad4.position())/.250; // experimental. Still providing pulse every other detent. Did get me thinking so I tried another far fetched idea. Remember at this time I am experimenting just to see the results. Not expecting it to work.

    long X4 =(quad4.position())/.025; // experimental. Still a pulse every other detent.

    Now I am thinking that I am not formating the /X correctly? Maybe the decimal point is not recognized or I need to put /.25 in parenthesis?

    long X4 =((quad4.position())/(.250)); // for half cycle encoders. // experimental. Still a pulse to every other detent.

    Wthout dragging this out much further I started using the multiplier (*) to see what I would get. Still the best result I would get is a pulse every other detent. If cannot be established while changing the sketch do I need to look into the quadrature.h or math.h ?

    Thanks












Page 2 of 3 FirstFirst 123 LastLast