Highest PWM frequency output for the Uno/Nano

OK, here is my sketch, still somewhat ugly:
// Timer 0
// output OC0A pin 12 (D6)

#include <TimerHelpers.h>
const int timer0OutputA = 6;//***
int inputPin = A0;//***
int sensorValue = 0;//*** variable to store the value coming from the sensor
const int outputPin = 6;//***
int outputValue = 0;//***
int freqInput = 0;//**
int freqOutput = 0;
int ledPin = 13;//***

void setup() {
//*** initialize serial communications at 9600 bps:
Serial.begin(2400);//***
pinMode (A0, INPUT);//***
pinMode (outputPin, OUTPUT);
pinMode (ledPin, OUTPUT);//***
// pinMode (timer0OutputA, OUTPUT); //***
TIMSK0 = 0; // no interrupts
Timer0::setMode (2, Timer0::PRESCALE_1, Timer0::TOGGLE_A_ON_COMPARE);
OCR0A = 1; // count to 2
} // end of setup

void loop()
{
digitalWrite (ledPin, LOW);
// read the value from the sensor:
freqInput = analogRead(inputPin);//***
freqOutput = analogRead(outputPin);
//*** stop the program for milliseconds:
delay(sensorValue);//***
Serial.print (freqInput);//***
Serial.print(" ");//***
Serial.print (freqOutput);//***
delay (0);//***

if abs(freqInput > 20)
{
Serial.println (" yes "); digitalWrite(ledPin, HIGH);
}
else
{ Serial.println (" no"); Serial.print(" "); digitalWrite (ledPin, LOW);
}
}

When I attempt to pause or delay the output, or hold the ledPin HIGH for a longer period, for example with a WHILE or delay() statement, the Serial.print output stops and does not restart unless I reset the board. Other than that, I seem to be getting the performance I was looking for. That is, when a loop attached to the output pin is in close contact with the input pin loop, the LED lights and stays on while the condition is true. (Ignore the //***; just to remind me where I made changes.)
Thanks for any further thoughts or guidance.