void setup()
{
}
void loop()
{
uint32_t now = millis();
static uint32_t past = now;
if ( now - past >= 5 )
{
past = now;
static bool invert = false;
static uint16_t frequency = 440;
tone( 12, frequency );
if ( ( invert == false && ++frequency == 1000 )
|| ( invert == true && --frequency == 440 ) )
{
invert = !invert;
}
}
}