Hey guys, I have disabled the line setting the encoder at -512, and now the encoder reads the value correctly.

Unfortunately the motor isnt working, the output from the PID is still constant , despite the Position changing
Any thoughts, I think its the PID causing the issues now, as the encoder reads correctly, and motor moves when an step is put in to it.
heres the code
#include <PID_v1.h>
#include <Encoder.h>
#include <Stepper.h>
const int pwmA = 3;
const int pwmB = 11;
const int brakeA = 9;
const int brakeB = 8;
const int dirA = 12;
const int dirB = 13;
const int STEPS = 200;
double m = 0;
double newPosition = 0;
double Position = 0;
int chanA = 20;
int chanB = 21;
Stepper myStepper(STEPS, dirA, dirB);
Encoder myEnc(chanA, chanB);
PID myPID(&Position, &m, 0, 1, 20, 100, DIRECT);
void setup() {
myStepper.setSpeed(90);
Serial.begin(9600);
pinMode (pwmA, OUTPUT);
digitalWrite(pwmA, HIGH);
pinMode(pwmB, OUTPUT);
digitalWrite(pwmB, HIGH);
pinMode(brakeA, OUTPUT);
digitalWrite(brakeA, LOW);
pinMode(brakeB, OUTPUT);
digitalWrite(brakeB, LOW);
}
long oldPosition = -999;
void loop() {
newPosition = myEnc.read();
if (newPosition != oldPosition) {
oldPosition = newPosition;
}
Position = ((newPosition/11.37)+180);
if (Position > 180) {
Position = Position -360;
}
if (Position < -180) {
Position = Position +360;
}
//Serial.println(Position);
myPID.Compute();
myStepper.step(int(m));
Serial.println(int(&m));
}
Just for referance, the PID wants the motor to move 536 steps no matter the actual location, I'm not sure why.