Need a low frequency (can preset at each value of 15Hz to 25Hz) PWM signal

Result. Having had problems with the code, I progressively stripped it back to a simple LED flashing circuit peeling away code to find the problem. Took some time. In the end the code "pinMode(outPin,OUTPUT)" was needed in Void Setup. With this in place, all of the noise on the output signal disappeared.

So now have a 20Hz PWM signal (can preset at any other frequency) and can adjust the duty cycle in range 15% to 85% (again can preset the range required). Brilliant outcome... now just need to try it with the treadmill controller board and find the exact frequency needed to trigger motion.

Thank you to all contributors, most of all wvmarle who stuck with me through the strange problems. A1.

Final code is below with explanation of Purpose, Design, Testing and Working Status upfront.

// Purpose: Produce PWM signal at 20Hz frequency and duty cycle of min'm of 15 % and max'm of 85%, the pot
// rotated for any value in between. For use to control LED brightness or as input signal to motor controller

// Design: Arduino UNO with 1K ohm input pot. Resistance value, pot wiper into pin A0
// pot has VCC from 5v pin and Ov from Grd pin). Output PWM signal is on pin 13.
// V4 has the line of code pinMode(outPin,OUTPUT); that removed the noisy Lo output signal in earlier versions.

// To preset the frequency, set the cycle time in the code , set variable 'period' (in uS) (1 / frequency)

// Testing: Oscillosocpe on output pin 13, unloaded, then with external LED. Yet to test on motor controller

// Working status OPERATIONAL. PRODUCES PWM 20 Hz OUTPUT SIGNAL, VARYING POT CHANGES THE DUTY CYLE #15% TO 85%

const byte potPin = A0; // Analog input pin that has the potentiometer wiper resistance value
const byte outPin = 13; // PWM output pin that Motor Controller) (or LED in testing) is attached to

float dutyCycle; // Defines the duty cycle, the % of the period (the cycle time) the PWM pulse is high
unsigned long period; // Defines the cycle time ( 1 / frequency) for PWM output
unsigned long lastChange; // The variable for incrementing the time through the loop
int outState = 0;; // The variable holding value of Hi or Lo output that is derived through the loop

void setup() {
pinMode(outPin,OUTPUT); //ADD THIS CODE LINE TO STOP THE NOISE PROBLEM
period = 33000; // 50,000 us period, to be used to set the output signal at 20Hz frequency.
}

void loop() {

dutyCycle = map(analogRead(potPin), 0, 1023, 8500, 1500) / 10000.0; // returns 15% to 85% duty cycle range based on pot rotation reading 0-1023.
unsigned long onTime = period * dutyCycle; // defines the high duration in us.
unsigned long offTime = period * (1 - dutyCycle); // defines the low duration in us.

if (outState == HIGH) {
if (micros() - lastChange > onTime) {
outState = LOW;
lastChange += onTime;
}
}
else {
if (micros() - lastChange > offTime) {
outState = HIGH;
lastChange += offTime;
}
}
digitalWrite(outPin, outState);
}