while (1)
{
if (!(PINB & (1 << PB2))) // If the button is pressed
{
_delay_ms(100); // Debounce
if (!(PINB & (1 << PB2))) // If the button is still pressed
{
frequency += 100; // Increase the frequency by 100Hz
OCR1A = F_CPU / (2 * frequency); // Update the output compare register
_delay_ms(100); // Wait for button release
}
}
}
}