How to set the sampling frequency in Arduino without using a delay
Use the concept of blink without delay. 

Instead of using delay() to set the timeout you use a timestamp and check micros() against that to see whether your interval has passed:

const unsigned long READ_PERIOD = 4000;  // 4000 us: 250 Hz

void loop() {
    static unsigned long lastRead;
    if (micros() - lastRead &gt;= READ_PERIOD) {
        lastRead += READ_PERIOD;
        if (digitalRead(10) == 1 || digitalRead(11) == 1)
            Serial.println('!');
        else
            Serial.println(analogRead(A0) * (3.3/1024));
    }
}