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

Do not automatically set pins to output when declaring instance of MC… #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Chluz
Copy link

@Chluz Chluz commented Jan 24, 2021

…P3017AccelStepper

Current versions of AccelStepper will by default set the provided pins to "output" when instanciating AccelStepper, see below:

AccelStepper(uint8_t interface = AccelStepper::FULL4WIRE, uint8_t pin1 = 2, uint8_t pin2 = 3, uint8_t pin3 = 4, uint8_t pin4 = 5, bool enable = true);
(...)
AccelStepper::AccelStepper(uint8_t interface, uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4, bool enable)
{
(...)
    if (enable)
	enableOutputs();
    // Some reasonable default
    setAcceleration(1);
}

This change will set `enable = false` before instanciating AccelStepper

I hope this helps other, this was my first time playing around with Arduinos and CPP; it caused immediate rst code 4 when using forbidden pins from my D1 Mini.

…P3017AccelStepper

Current versions of AccelStepper will by default set the provided pins to "output" when instanciating AccelStepper, see below:
```
AccelStepper(uint8_t interface = AccelStepper::FULL4WIRE, uint8_t pin1 = 2, uint8_t pin2 = 3, uint8_t pin3 = 4, uint8_t pin4 = 5, bool enable = true);
(...)
AccelStepper::AccelStepper(uint8_t interface, uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4, bool enable)
{
(...)
    if (enable)
	enableOutputs();
    // Some reasonable default
    setAcceleration(1);
}

This change will set `enable = false` before instanciating AccelStepper

I hope this helps other, this was my first time playing around with Arduinos and CPP; it caused immediate rst code 4 when using forbidden pins from my D1 Mini.
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

Successfully merging this pull request may close these issues.

1 participant