Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy 3.5 and Encoder Library

  1. #1
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,893

    Teensy 3.5 and Encoder Library

    I am trying to use pins 57 and 56 on a Teensy 3.5 with the Encoder library and having some problems.

    When I use pin 56 with a hall effect sensor I get 0 for all the readings ( I am reading every 100 ms) while on pin 57 it will read for about 400ms and then go to zero. I am using the same sensors on two other pins and have no problem. To check the pins I attached a LED and had them blinking so I know the connection to the teensy is good.

    In full disclosure I do have a usb host board attached as well as two bumper switches which I have using interrupts.

    If anyone has any suggestions it would be appreciated.

    Mike

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,039
    Is this sensor actually a quadrature encoder? Many Hall effect sensors are just a simple pulse, not quadrature encoded.

  3. #3
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,893
    No it is not. It is a simple hall effect sensor. The reason for the question is that I am trying an experiment where I use two hall effect sensors to get a quadrature signal.

    My first test was to use the library with one of the encoder on 24 and the second on pin 57 but it kept return 0 or 1 or -1 no matter where the sensor spacing (90 , 180 etc.).

    Just as background I am using the same sensors on pins 24 and 25 to give me the left and right wheel count using the encoder library. I use the call like so: Encoder encA(r_encoder, r_encoder);. I didn't think it was going to work but it did. The second test was just to test pin 57 with wheel encoder on it in the same format as the library but it kept returning 0 or 1 expcept for firs couple of readings which is what I thought the reading should be.

    The next couple of tests was to try and count the pulses using a couple of different techniques that I found online but again kept just reading 0 or 1.

    If you have any suggestions on how to do approach this I would appreciate it.

    Thanks
    Mike

    UPDATE: 2/21. I changed the pin from 57 to 1 and tried using the trick with the encoder library and it doesn't work on that pin. Not sure why it works with pins 24 and 25?
    Last edited by mjs513; 02-21-2017 at 03:30 PM. Reason: Update

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •