Easy Driver Stepper Motor Coding Issue

Greetings, Im having a play running a stepper motor from a potentiometer to control speed, and a switch to control direction. The code is designed to vary PWM frequency as the value of the pot changes. I have wired pins 9 and 8 to STEP and DIR on the board, along with GND to GND.
The direction change is working fine, however the pot is being unusual. The output values coming back from the serial.print are spot on what i would expect, however: at either end of the pot there is no movment at all, in the middle i get a constant speed. I dont get this at all.
Here is the code:

const int PotSignal = A0;
const int SwitchSignal = 0;
const int StepOut = 9;
const int Direction = 8;

int PotValue = 0;
int SwitchValue = 0;
int PulseSpeed = 0;

void setup() {
  Serial.begin(9600);
  pinMode (PotSignal, INPUT);
  pinMode (SwitchSignal, INPUT);
  pinMode (Direction, OUTPUT);
}

void loop() {
 PotValue = analogRead(PotSignal);
 SwitchValue = digitalRead(SwitchSignal);
 if (SwitchValue == HIGH) {
   digitalWrite (Direction, LOW);
 } else  {
   digitalWrite (Direction, HIGH);
 }
 PulseSpeed = map(PotValue, 0, 1023, 0, 255);
 
 analogWrite(StepOut, PulseSpeed);
 
  Serial.println(PotValue, DEC);
  Serial.println(SwitchValue, DEC);
  Serial.println(PulseSpeed, DEC);
   
 delay (10);
}

Anyone have any ideas why I'm only getting one pulse width from this thing?

Many thanks!

a circuit picture would be useful!

The PWM output from analogWrite() doesn't change the RATE at which the PWM pulses occur and so it won't change the rate of the STEP signal to your stepper driver. At a value of 0 the PWM signal will be LOW all the time and there will be no pulses to step the stepper. At a value of 255 the PWM signal will be HIGH all the time and, again, no pulses means no steps.

Bingo!
Nice one John. I had just worked this out having watched Doctor Who, only to come on here and find it very elegantly put. I'll have a play with High; Low; code and see how I get on...
Cheers!

I've had a play with this and got it doing close to what i want, however it is abit slow. I found the delaymicroseconds command, and when running this in a simple sketch its works great, however when i copy this into the above code its still quite slow. Is it likely that the rest of the code is slowing it down?

If you check the pot between each step it will likely slow things down quite a bit. Perhaps you should check the pot and then do 200 steps at that rate before checking again.

If you use a variation of the code from the Blink Without Delay you should be able to have it check the pot every tenth of a second (or whatever gives you the responsiveness you want) and do steps the rest of the time. If you are doing debug output you should also do that only periodically.