Highest PWM frequency output for the Uno/Nano

// 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 <sensorValue> 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);
  }
}