Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

single pin encoder support #47

Closed
tinyboxxx opened this issue Sep 5, 2021 · 5 comments
Closed

single pin encoder support #47

tinyboxxx opened this issue Sep 5, 2021 · 5 comments

Comments

@tinyboxxx
Copy link

Hi, Nice work!

I want use this in my speedo project, is it possible to attach a single pin encoder? I only need one direction.

I didn't find related ways to do it in document.

Thanks!

@tinyboxxx
Copy link
Author

thanks for your quick reply,

I did noticed that attachSingleEdge function, but one question:
Since I only got one signal pin, but which pin should I put into bPinNumber ?

thanks again.

@madhephaestus
Copy link
Owner

madhephaestus commented Sep 8, 2021 via email

@tinyboxxx
Copy link
Author

huge Thanks!

@tinyboxxx
Copy link
Author

Hello, I got error when ESP32 booting, in serial.

E (719) pcnt: pcnt_unit_config(57): PCNT pluse input io error
E (720) pcnt: pcnt_unit_config(57): PCNT pluse input io error
E (720) pcnt: pcnt_unit_config(57): PCNT pluse input io error
E (725) pcnt: pcnt_unit_config(57): PCNT pluse input io error

ESP32 does keep running. Any idea what cause this error? Does some GPIO I can't use?
Thanks.

Code I use:

#include <ESP32Encoder.h>
ESP32Encoder encoder_speed;
ESP32Encoder encoder_rpm;

//in setup:

  ESP32Encoder::useInternalWeakPullResistors = UP;
  encoder_speed.attachSingleEdge(27, 27); // SPD
  encoder_rpm.attachSingleEdge(34, 34);   // RPM

//in loop:
        PulseCounter_SPD = (int32_t)encoder_speed.getCount();
        PulseCounter_RPM = (int32_t)encoder_rpm.getCount();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants