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

Attach with Min Max bug #103

Open
Teehee2 opened this issue Jul 18, 2022 · 2 comments · May be fixed by #101
Open

Attach with Min Max bug #103

Teehee2 opened this issue Jul 18, 2022 · 2 comments · May be fixed by #101
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@Teehee2
Copy link

Teehee2 commented Jul 18, 2022

There seems to be an issue witihin the library for values of min and max in the attach(pin, min, max) function.
I am using an official Arduino Uno R3 and IDE version 1.8.19, Servo library version 1.1.8.
I am reading values back using the readMicrosecond function through Serial.

When using the overloaded attach function, min values above 1059 and max values below about 1900 do not work. Instead the library acts as no limits, my serial prints even reach up to 2800 microseconds. Please see details below:

Smallest microsecond range (works perfectly):

int min = 1059;
  int max = 1900;
  Servo2.write(0);
  Serial.println(Servo2.attach(servo2Pin, min, max));
  tftText("Servo 2");

'Unlimited' range after higher min:

int min = 1060
  int max = 1900;
  Servo2.write(0);
  Serial.println(Servo2.attach(servo2Pin, min, max));
  tftText("Servo 2");

'Unlimited' range after higher max:

int min = 1060
  int max = 1850;
  Servo2.write(0);
  Serial.println(Servo2.attach(servo2Pin, min, max));
  tftText("Servo 2");

Higher range reaches up to about 2865:
image

Edit 23:40 18/07/2022: Wrong value for max, fixed now.

@Teehee2 Teehee2 closed this as completed Jul 18, 2022
@Teehee2
Copy link
Author

Teehee2 commented Jul 18, 2022

Just saw #101 , seems to provide a fix. Thanks guys!

@Teehee2
Copy link
Author

Teehee2 commented Jul 18, 2022

After some testing changing from uint8_t to int only slightly allows more flexibility. There still seems to be a problem.

@Teehee2 Teehee2 reopened this Jul 18, 2022
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Jul 19, 2022
@per1234 per1234 linked a pull request Jul 19, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants