 int potentiometer_pin = 2;                   //Pin 3 on ATtiny
 int output_pin = 1;                          //Pin 6 on ATtiny
 int filter_size = 50;                        //Noise reduction filter size
+int output_val = 0;
 
 SignalProcessing input(input_pin, filter_size);
 

  if(state == LOW && input_val > pot_val+threshold)
  {
    state = HIGH;
    output_val = input_val/4;
  }
  else if(state == HIGH && input_val < pot_val-threshold)
  {
    state = LOW;
    output_val = 0;
  }
  
  digitalWrite(output_pin, output_val);
}

void loop()
{
  int input_val = cutAndMap(input.filteredAnalogRead(AVERAGE), 50, 975, 0, 1023);
  
  /*if(input_val < 0)
    input_val = 0;
