error codes makes no sense for me

Hey boys, I have a little problem, I'm about to get a stepper motor to drive,
but the compilation of the program failed :confused:
I've tried different codes but with the same result
although the example is with the library Steppers, Knop.ino fails
comes with the following error messages:

knop.cpp.o: In function _GLOBAL__sub_I_MYstepper ': /usr/share/arduino/knop.ino:21: undefined reference two Stepper :: setspeed (long) '
/usr/share/arduino/knop.ino:21: undefined reference two Stepper :: step (int) ' /usr/share/arduino/knop.ino:21: undefined reference two Stepper :: Stepper (int, int, int, int, int) '
collect2: error: ld returneres 1 exit status

I use Linux, do not know if it had anything to say, have not before experienced problems

Sigh...
Please post an example of a full program that exhibits the problem.

Where is the stepper motor library folder installed ?

/*

  • MotorKnob
  • A stepper motor follows the turns of a potentiometer
  • (or other sensor) on analog input 0.
  • Stepper - Arduino Reference
  • This example code is in the public domain.
    */
    #include </usr/share/arduino/libraries/Stepper/Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to

Stepper MYstepper(STEPS, 8, 9, 10, 11);

// the previous reading from the analog input
int previous = 0;

void setup()
{
// set the speed of the motor to 30 RPMs
MYstepper.setSpeed(30);
}

void loop()
{
// get the sensor value
int val = analogRead(0);

// move a number of steps equal to the change in the
// sensor reading
MYstepper.step(val - previous);

// remember the previous value of the sensor
previous = val;
}

and stepper.h and stepper.cpp installed in /usr/share/Arduino/libraries/Stepper/

Try either #include<Stepper.h> or #include "/usr/share/arduino/libraries/Stepper/Stepper.h"

I can't remember if the first version should have a capital S, but it would be easy to try both

...R

everything is spelled correctly and there are large and small lettering grouped together where they should be.
Have tried to change uppercase to lowercase.

The line that says

#include </usr/share/arduino/libraries/Stepper/Stepper.h>

Should say

#include <Stepper.h>

Then it will compile. Tested under 1.0.6.

I have to have the full path, otherwise I get error

fatal error: Stepper.h: Ingen sådan fil eller filkatalog

Using Linux should the path not be Documents/Arduino/libraries/Stepper/Stepper.h ?
Then you can use #include <Stepper.h>

This page would perhaps be worth reading Installing additional Arduino libraries

It does not matter where I lie libraries, just the path is correct,
has put more libraries in /usr/share/Arduino/libraries/...
without that it has created problems
I think that there is somewhere that needs to be made a small correction, but where is it ???

Do you have a Documents/Arduino/libraries/ directory ?

no !!
it is not the location that is the problem,
if it was, I got a different error message,
the problem is the way Steppers are inherited, or whatever it's called !

The problem is solved :slight_smile:

Tried to place Stepper.cpp & stepper.hi same directory as knop.ino and then it works !!!!!
why I can not answer !!
I am happy :slight_smile:
Hope others can get a little joy of my problems:-)

Tried to place Stepper.cpp & stepper.hi same directory as knop.ino and then it works !!!!!

What directory would that be ?

Carsten_F:
everything is spelled correctly and there are large and small lettering grouped together where they should be.
Have tried to change uppercase to lowercase.

Did you try using " " instead of <> as I suggested?

...R

Carsten_F:
no !!
it is not the location that is the problem,
if it was, I got a different error message,
the problem is the way Steppers are inherited, or whatever it's called !

Do you still stand by that post?

Why did you not believe me? I did test it and I did tell you I tested it.