From af8e48f3204d52980395016d9bdc17e0cbe43e65 Mon Sep 17 00:00:00 2001 From: DrakeTheCoder <105813281+DrakeTheCoder@users.noreply.github.com> Date: Sun, 9 Nov 2025 04:54:07 +0300 Subject: [PATCH] Change the order of the pins in the constructor Since Stepper.h library uses `1010`, `0110`, `0101`, `1001` sequence for four-wire connection. --- .../04.stepper-motors/stepper-library-examples.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/content/learn/04.electronics/04.stepper-motors/stepper-library-examples.md b/content/learn/04.electronics/04.stepper-motors/stepper-library-examples.md index 19494de4d8..189630643c 100644 --- a/content/learn/04.electronics/04.stepper-motors/stepper-library-examples.md +++ b/content/learn/04.electronics/04.stepper-motors/stepper-library-examples.md @@ -54,7 +54,8 @@ A stepper motor follows the turns of a potentiometer (or other sensor) on analog // create an instance of the stepper class, specifying // the number of steps of the motor and the pins it's // attached to -Stepper stepper(STEPS, 8, 9, 10, 11); +// (note the order for 2th and 3th pins) +Stepper stepper(STEPS, 8, 10, 9, 11); // the previous reading from the analog input int previous = 0; @@ -88,7 +89,8 @@ const int stepsPerRevolution = 200; // change this to fit the number of steps p // for your motor // initialize the stepper library on pins 8 through 11: -Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); +// (note the order for 2th and 3th pins) +Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); void setup() { // set the speed at 60 rpm: @@ -121,7 +123,8 @@ const int stepsPerRevolution = 200; // change this to fit the number of steps p // for your motor // initialize the stepper library on pins 8 through 11: -Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); +// (note the order for 2th and 3th pins) +Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); int stepCount = 0; // number of steps the motor has taken @@ -153,7 +156,8 @@ const int stepsPerRevolution = 200; // change this to fit the number of steps p // initialize the stepper library on pins 8 through 11: -Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); +// (note the order for 2th and 3th pins) +Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); int stepCount = 0; // number of steps the motor has taken @@ -173,4 +177,4 @@ void loop() { myStepper.step(stepsPerRevolution / 100); } } -``` \ No newline at end of file +```