Microstepping A4988 and wireing

I have my arduino and the motor running in fullstepmode currently, successfully. I want it to run in microstepping now.

Ok i know that for beeing able to use microstepping i have to set M1 M2 M3 LOW/High. Already found that info and table on the web.
Does that actually mean i have to connect M3 M1 M2 to the arduino digitalPins and then just send the appropriate combination? I think so, but i need some confirmation.

Thank you for your help.

You can simply hardwire those pins to ground and 5V as appropriate.

If you want to change the number of microsteps with software then you can wire them to Arduino pins. That usually isn't necessary.

So as soldering is already neccessary, i think i will directly solder them to the digital pins instead of directly to GND/5V.
That way has more advantages as i have lot of digitalPins unused.

Thank you.

Ok so i connected M1 M2 and M3 to A0, A1 and A2.
When i now set this in the code, microstepping should work with 1/4 Steps. Is that correct?

//enable
digitalWrite(ENABLE_PIN, LOW);

//mircostepping
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
       
digitalWrite(A0, LOW);
digitalWrite(A1, HIGH);
digitalWrite(A2, LOW);

Because with my current code the motor is not moving at all. In fullstepmode it was. I just added the three cables/pins.

Here is the function that worked with fullstep, i added the microstep code now

//--------------------------NORMAL button 
     if ((y >= 10) && (y <= 60) && (x >= 10) && (x <= 210) ) { 
       touchBorder(10, 10, 210, 60);
       updateStr("Start Motor");   

       //mircostepping
       pinMode(A0, INPUT);
       pinMode(A1, INPUT);
       pinMode(A2, INPUT);
       
       digitalWrite(A0, LOW);
       digitalWrite(A1, HIGH);
       digitalWrite(A2, LOW);

       //das geht so nur mit setmaxspeed und acceleration
       //enable disable power manuelly
       digitalWrite(ENABLE_PIN, LOW);           
       
       stepper.setCurrentPosition(0); //must be set to 0 because manual moving START/BACKW/HOME may have changed the position and normal must always begin at start/0
       stepper.moveTo(slider_length);

       //300 = 9cm, ausgemesssen = 4000
       while (stepper.currentPosition() != slider_length) {
         Serial.print("START");          
         Serial.print(stepper.currentPosition());
         Serial.print("\r\n"); 
         // Full speed up to 300  
         stepper.setSpeed(speed_set);  
         stepper.run();          
       }               

       //after the run move back to position 0. that happens with acceleration
       Serial.print("END");
       
       stepper.runToNewPosition(0);        
       digitalWrite(ENABLE_PIN, HIGH);             
     }

Make your pins OUTPUT mode.

Ok i set

pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);

Motor does not move. I also have tried setting them all to LOW. That should enable fullstep. But still the code, that worked before is not working.
Are there any other wires that need to be modified when switching from a simple fullstep A4988 setup to a microstep setup?
Maybe i forgot something

Reset/Sleep is bridged (connected by a jumper)

PeaceOfCholice:
Maybe i forgot something

Yes.

You did not post your latest program or your latest wiring diagram. Without those we cannot know what you have done, right or wrong.

Also, what stepper motor power supply are you using (volts and amps)?

...R

No problem. Here we go.
Schema attached.

The code i run is. I have set all to LOW to try if fullstep works first.

//--------------------------NORMAL button 
      if ((y >= 10) && (y <= 60) && (x >= 10) && (x <= 210) ) { 
        touchBorder(10, 10, 210, 60);
        updateStr("Start Motor");   

        //mircostepping
        pinMode(A0, OUTPUT);
        pinMode(A1, OUTPUT);
        pinMode(A2, OUTPUT);
        
        digitalWrite(A0, LOW);
        digitalWrite(A1, LOW);
        digitalWrite(A2, LOW);

        //das geht so nur mit setmaxspeed und acceleration
        //enable disable power manuelly
        digitalWrite(ENABLE_PIN, LOW);           
        
        stepper.setCurrentPosition(0); //must be set to 0 because manual moving START/BACKW/HOME may have changed the position and normal must always begin at start/0
        stepper.moveTo(slider_length);

        //300 = 9cm, ausgemesssen = 4000
        while (stepper.currentPosition() != slider_length) {
          Serial.print("START");          
          Serial.print(stepper.currentPosition());
          Serial.print("\r\n"); 
          // Full speed up to 300  
          stepper.setSpeed(speed_set);  
          stepper.run();          
        }               

        //after the run move back to position 0. that happens with acceleration
        Serial.print("END");
        
        stepper.runToNewPosition(0);        
        digitalWrite(ENABLE_PIN, HIGH);             
      }

Here is an online version of the image too


Fullsize: Imgur: The magic of the Internet

You have not posted a complete program.

If the motor is not working then I would start with a simpler program. Try the first example from this Simple Stepper Code

Just modify it as little as possible to match your I/O pins and to add control for the microstepping pins.

...R
Stepper Motor Basics

Everything is fine, what i posted works.
Power supply was not working correctly, so the motor had no power.
Thank you for your tips.

Thanks for the update.

...R