Accelstepper will not run motor , no pulses

Well I am trying to adapt this code to sue Accelstepper , I need deceleration for this system ( it is a step mtr connected to a air pressure regulator with a air pressure sensor for feedback controlled by 0-3.3vdc in to a Nano board ) I have this working with the older code ( non accelstepper , I left the old code commented out in the file )
I get no pulse on pins 12,13,14 / D8,D9,D10 on the Nano , WHAT am I missing ??
Please comment mainly on the stepper part , I can sort out other issues later ( I will take any help LOL! )

#include <Arduino.h>
//#include "BasicStepperDriver.h"
#include <AccelStepper.h>
//#include "DRV8825.h"
#include <MovingAverage.h>
MovingAverage average(0.01f);

//#define MOTOR_STEPS 400
//#define RPM 30
//#define MICROSTEPS 1
//#define DIR 8
//#define STEP 9
#define ENABLE 10

AccelStepper stepper( 1, 13, 12); //13step-12dir pins
int sensorValue0 = analogRead(A2); // sensor
int sensorValue1 = analogRead(A3); // pot
int val0 = 0;
int val1 = 0;
float deadBand;
double error;

void setup() {
  average.reset( analogRead(A2) );  // sensor
  // stepper.begin(RPM, MICROSTEPS);

  deadBand = 12;  //stop moving when error < deadBand
void measurePressure() {
  int raReading = analogRead(A2);  // sensor
  float psi0 = ((30 - 0) / (620.0 - 0.0)) * (raReading - 83.0);
  Serial.println(psi0);   // 620-0.0,  ra = 83
  // Serial.println("psi"); // R1 res=10k,  R2=20k ohm to gnd

void loop() {
  ( average.update( analogRead(A2) ) );

  int  val0 = analogRead(A2);            // read the input pin
  val0 = map (val0 , 1022 , 102, 1023 , 0);

  //val0 = constrain(val0, 0, 1024);    // limits to 0-30psi range 102,692
  Serial.println(val0);             // sensor
  val1 = analogRead(A3) ;   // read the input pin , add offset=6
  // val1 = constrain(val1, 0, 1024);    // limits to 0-30psi range 102,692
  // Serial.println(val1);             // pot
  // Serial.println("pot");

  error = val0 - val1;
  if (abs(error) < deadBand ) error = 0;

  //  stepper.enable();
  // stepper.move(-error);
  /// stepper.disable();
  // delay(5); 

OK I found my error but I have a new problem , the motor will not reverse ? it should home in to the -error ( thats how it worked on my old code ) I also have to use very high speed/accel #'s like 50,000,


I tried removing the - sign in stepper.moveTo (-error); it did not work , I also tried to reverse these VAL error = val0 - val1; still no reverse ? what am I missing ?

what am I missing ?

Rather than soliciting quick fixes for a more deeply entrenched issue, you need to spend some time with the AccelStepper class reference documentation. This library is unlike many others you may have used in the past and requires a somewhat different mindset. If you intend to continue to uses AccelStepper, study those documents closely.

Personally, I choose not to use it. The MultiStepper class at first looked impressive, until you learn that the price you pay is in giving up acceleration. If you examine the torque curves for stepper motors, infinite acceleration (going from zero to full on in one) breaks down very quickly at speed. Without acceleration, you are without high-speed capabilities. This can be mitigated by 'stair-casing' your velocity profile, but that's a bit of a mickey-mouse way of doing things when there are better options available.

Well I am trying to adapt this code to sue Accelstepper ,

When using a new library always start with some very simple programs to ensure that you understand it fully - especially the examples that come with the library.

The AccelStepper library is one of the few with very good documentation but the documentation is still not as comprehensive as it should be so some experimentation is a good idea.