Arm Mbed and Pelion Device Management support forum

Problem with importing a library

Hi mbed developers,

I’m having a problem with importing a Stepper motor library.
Every library i try to import is showing me the same error message.

example:
Error: Identifier “Stepper” is undefined in “Stepper.h”, Line: 12, Col: 4

But I already declared the class stepper in the code:

#include "mbed.h"
#include "Stepper.h"

DigitalOut myled(LED1);

DigitalIn home(PTA0);
  Stepper mot(PTB1,PTA1);
 
  int main()
  {
     mot.setSpeed(1200);
     mot.setAcceleration(4000);
     mot.setDeceleration(4000);
 
     mot.rotate(CW);
     while(!home);
     mot.stop();
     mot.setPositionZero();
 
     mot.goesTo(1600);
     while(!mot.stopped());
 
     while(1)
     {
 
     }
  }
}

I’d appreciate some help :slight_smile:

Thanks!

Which library (libraries?) are you trying to use? Can you share a link to the library? The error message indicates there is something wrong with the header file.

Are you using this library ?https://os.mbed.com/users/franzachatz/code/stepper//file/ad11f550b379/stepper.h/

Yes! I’m trying to compile, but something about the great majority of the
stepper motors libraries (for mbed) seems trouble.

I’m trying to find a stepper motor usable in mbed compiler. Using the Nordic NRF52840-DK
target. But the libraries always seems incomplete or something like that.

https://os.mbed.com/users/franzachatz/code/stepper//file/ad11f550b379/stepper.h/

That’s the link, thanks!

When you use the code from above and library from this link then you combine two different things.
For your code probably need this one Stepper .

However in .h files of both library you can found an example, how to use the library.

BR, Jan