#define LED_PIN   (0)  // PB0 pin
#define ADC_PIN   (A1) // PB2/ADC1 pin
#define MIN_VALUE (300)

void setup() {
  pinMode( LED_PIN, OUTPUT );
}

void loop() {
  // read an analog value from the ADC pin
  int value = analogRead( ADC_PIN );
  // update PWM output
  if ( value < MIN_VALUE ) {
    analogWrite( LED_PIN, 0 );
  } else {
    // map the value to 0..255
    value = map( value,MIN_VALUE,1023,0,255 );
    analogWrite( LED_PIN, value );
  }
  delay(10);
}
ATTINY8520PU