Switching stepper motor

I have some code that makes a LED go on or off. I am using this to find two places where I can change a stepper motor direction by holding down a button. However the LED stops going on/off when adding the stepper motor lines of code, and it only runs in one direction all the time when I cut out the LED part.

Any ideas where I am going wrong, thanks

#include <CustomStepper.h>

int val = 0;     // variable for reading the pin status
int inPin = 12;   // choose the input pin (for a pushbutton)
int ledPin = 13; // choose the pin for the LED

CustomStepper stepper1(8,9,10,11, (byte[]){8, B1000, B1100, B0100, B0110, B0010, B0011, B0001, B1001}, 4075.7728395, 12, CW);
//CustomStepper stepper2(4,5,6,7, (byte[]){8, B1000, B1100, B0100, B0110, B0010, B0011, B0001, B1001}, 4075.7728395, 12, CW);


void setup() {
    pinMode(inPin, INPUT);    // declare pushbutton as input
    pinMode(ledPin, OUTPUT);  // declare LED as output
    stepper1.setRPM(3);
    stepper1.setSPR(4075.7728395);
}

void loop()
{
  if (stepper1.isDone())

  {
  val = digitalRead(inPin);  // read input value
  if (val == HIGH) {         // check if the input is HIGH (button released)
  digitalWrite(ledPin, LOW);  // LED ON
  
    stepper1.setDirection(CCW);
    stepper1.rotate(0);
    
   } else {
    
   digitalWrite(ledPin, HIGH);  // LED OFF
   
    stepper1.setDirection(CW);
    stepper1.rotate(0);

}
  }
   stepper1.run();
  }

Any ideas where I am going wrong, thanks

First thing you are doing is assuming that we are intimately familiar with the CustomStepper library. That is not the case. Post a link to the library.

Second thing is the horrid indenting of your code. There is no excuse for that, when Tools + Auto Format is so easy to use.

Third, NOTHING follows the }, NOT even the else statement.

Sorry, but I am completely new to Arduino and it's language. Someone else might know what you don't?

One has to learn sometime

Someone else might know what you don't?

Like where to get the library you are using? Why should we guess that we found the right one. YOU are the one that should post a link.

YOU are the one that should use Tools + Auto Format and the carriage return.

Just hope someone out there is a bit more considerate to someone starting out. You seem so agressive?

Don't bother coming back, I will wait for someone else that might know what my problem is. That library must be used by lots of other people.

ZOR2:

I'm amaze at how you just dismiss PaulS suggestion. He's a freaking Brattain Member, You know how many Brattain Member in this Forum? He's one of the forum Royalty. Have you ever stop and think how he able to gain such level? He help so many over the years. I wont ever think he does have any prejudice towards you. Take it with and open heart and try to improve with what PaulS have suggested. Unless you get your act together, I think not many will be willing to help you.

ZOR2:
That library must be used by lots of other people.

There are multiple versions. If you want help, post a link to the library you are using.

We certainly need a link to the library so we can read the documentation.

Also post a link to the datasheet for the stepper motor you are using and tell us what stepper driver you are using.

...R
Stepper Motor Basics
Simple Stepper Code

Many thanks Coding Badly, Robin2.

I got the library code via Google, will try and search where I got it. I was unaware there would be a library forum somewhere else. Being new to Arduino for just 10 days I aimed my question towards what I thought to be correct "Language, Coding help"

So being new and told horrid indenting of code, NOTHING follows the }, NOT even the else statement. was of no help and just came back as agressive and not willing to help. All it needed was sorry but please try to find the Forum section related to this library, also please use Tools/Auto Format before posting code.

Now I understand I will do.

ok, now you might have understood.
Being new to a forum and the arduino stuff, it would always be a good idea to read the rules first before posting.
In this forum in each category there is at least one thread on top of all other threads which reads "How to use this forum".

Unfortunately most of newbies just skip that section and expect that they are helped immediately and that everybody here is willing to spend precious free time into the project with so little background or precise information - that won't work!

It's up to the questionner to assist with as much information as possible in the way the forum rules are set.

That said, pls find the link to your library and post it here.
There are so many different libraries out there and there is - besides of github - a lot of other sources available, where you can download libraries.

Note, that

  1. there is never a guarantee that a library will really work with your given hardware and on top of that
  2. you might find libraries which have the same name, but act very differently (e.g. lcd libraries)