How to execute a function for "t" time without delay + using external interrupt

PeterH:
You don't need interrupts for this. All you need is to set a flag when you detect that the measurement should start, and clear it when it should end. In loop(), use the techniques demonstrated in the 'blink without delay' example sketch to collect your sensor inputs at regular intervals while the flag is set.

I guess that the keyboard you refer to is the keyboard on the host PC. You need to use some application on the host PC to send the keyboard input to the Arduino. If you plan to use the Arduino IDE's serial monitor for this, bear in mind that the serial monitor input is line buffered so you would need to enter your command character(s) followed by the return key to send that command to the Arduino. In other words, two key presses. If you were thinking about using buttons directly connected to the Arduino instead, that would work fine too but you'd need to read (and debounce) the switch states instead of reading commands from the serial port.

Hi PeteH, I will use Processing to control Arduino from PC. I would like to design an interface with some button, each one used to trigger Arduino to communicate with one of the sensors (using something like a "switch case" loop in the Arduino's sketch ). I have 4 sensors connected to Arduino: 3 of them will print one simple float value to the Serial port each other and these values will be printed on my Processing interface as numeric values. Instead, the 4th sensor, specifically the pressure sensor, will print automatically one value per second for (i.e.) 3 minutes on the serial port, when trigged (through Arduino) by pressing one button on the Processing interface. To realize the interrupt for the pressure sensor I thought to have two button (one to start the measurement and the other to stop it) dedicated in the Processing interface.