Then why not something like:
void loop ()
{
if (digitalRead(switchpin) == HIGH) // or whatever value you meant
{
delay(4000);
useless.write(250);
while (digitalRead(switchpin) == LOW) // I rather guessing what your switch input means...
{}
useless.write(40);
}
}