Accelstepper

ok thanks again for the reply's

UKHeliBob ... I tried the eeprom.put and get ... no luck...I installed the serial print to check what I get and it's "2046820361" as a result...go figure.

MarkT ... Don't I have to have "stepper.run" in every of my sub-functions? Don't they act as loops? And when I try to use "stepper.stop()" I get "class Accelstepper has no member named stop".

Robin2 ... Sorry .. If I take the "stepper.run" out of my functions and put one into my "void loop" stepper does not turn at all.

Here is the update code

#include <EEPROM.h>
#include <AccelStepper.h>
//#include <EEPROMAnything.h>

AccelStepper stepper (1, 8, 9);
const int progButton = 2;
const int rotoS = 3;
const int rotoM = 4;
const int rotoL = 5;
const int rotoO = 6;
const int rotoP = 7;
const int endStop = 10;
const int startButton = 12;
const int homeButton = 11;
byte endStopState = 0;
byte startButtonState = 0;
byte homeButtonState = 0;
byte progButtonState = 0;
byte rotoSState = 0;
byte rotoMState = 0 ;
byte rotoLState = 0;
byte rotoOState = 0;
byte rotoPState = 0;
int long i = 0;
int long p = 0;
int k = 0;
int addr = 0;

void setup() {
  pinMode(progButton, INPUT);
  pinMode(endStop, INPUT);
  pinMode(startButton, INPUT);
  pinMode(homeButton, INPUT);
  pinMode(rotoS, INPUT);
  pinMode(rotoM, INPUT);
  pinMode(rotoL, INPUT);
  pinMode(rotoO, INPUT);
  pinMode(rotoP, INPUT);
  EEPROM.begin();
  Serial.begin(115200);
  stepper.setMaxSpeed(5000);
  stepper.setAcceleration(800);
}

void loop() {
  homeButtonState = digitalRead(homeButton);
  if (homeButtonState == HIGH) {
    Home();
  }

  rotoSState = digitalRead(rotoS);
  startButtonState = digitalRead(startButton);
  if ((startButtonState == HIGH) && (rotoSState == HIGH)) {
    Small();
  }

  rotoMState = digitalRead(rotoM);
  startButtonState = digitalRead(startButton);
  if ((rotoMState == HIGH) && (startButtonState == HIGH)) {
    Mid();
  }
  rotoLState = digitalRead(rotoL);
  startButtonState = digitalRead(startButton);
  if ((rotoLState == HIGH) && (startButtonState == HIGH)) {
    Large();
  }
  rotoOState = digitalRead(rotoO);
  startButtonState = digitalRead(startButton);
  if ((rotoOState == HIGH) && (startButtonState == HIGH)) {
    stepper.setMaxSpeed(4000);
    stepper.setAcceleration(500);
    stepper.moveTo(p);
    p = p + 1;
    stepper.run();  // Start moving the stepper
    rotoPState = digitalRead(rotoP);
    progButtonState = digitalRead(progButton);
    if ((rotoPState == HIGH) && (progButtonState == HIGH)) {
      EEPROM.put(addr, p);
    }
  }
  rotoPState = digitalRead(rotoP);
  startButtonState = digitalRead(startButton);
  if ((rotoPState == HIGH) && (startButtonState == HIGH)) {
    Prog();
  }
}
/////////////////// Function to bring the sled in to the home position. //////////////////
void Home() {
  while (digitalRead(homeButtonState)) {
    endStopState = digitalRead(endStop);
    if (endStopState == LOW) {
      stepper.moveTo(-5000);
      stepper.run();  // Start moving the stepper
    } else {
      stepper.setMaxSpeed(0);
      stepper.setCurrentPosition(0);
      homeButtonState = 0;
      break;
    }
  }
}
//////////////////// Function to fill the small syringe to it's maximum. ////////////////////
void Small() {
  for (i = 0; i <= 7600; i++) {
    stepper.setMaxSpeed(4000);
    stepper.setAcceleration(500);
    stepper.moveTo(i); //Number for small syringe 24500
    /*  if (i == 7600) {
        stepper.stop();
      }  */
    stepper.setCurrentPosition(0);
    stepper.run();  // Start moving the stepper
  }
}
//////////////////// Function to fill the medium syringe to it's maximum. /////////////////
void Mid() {
  for (i = 0; i <= 7500; i++) {
    stepper.setMaxSpeed(5000);
    stepper.setAcceleration(800);
    stepper.moveTo(i);
    stepper.setCurrentPosition(0);
    stepper.run();  // Start moving the stepper
  }
}
///////////////////// Function to fill the large syringe to it's maximum. ///////////////////
void Large() {
  for (i = 0; i <= 8900; i++) {
    stepper.setMaxSpeed(5000);
    stepper.setAcceleration(800);
    stepper.move(i);
    stepper.setCurrentPosition(0);
    stepper.run();  // Start moving the stepper
  }
}
///////////////// Function to read from eeprom. ///////////////////////
void Prog() {
  EEPROM.get(addr, p);
  stepper.setMaxSpeed(5000);
  stepper.setAcceleration(800);
  stepper.move(p);
  Serial.println(p);
  stepper.run();  // Start moving the stepper

}