Hello MVestjens,
two possibilities:
1) Use "Wait for Front Panel Activity" and check if the user hits a key.
2) Use Event structure to check for a keypress.
Put one of the possibilities into a while loop running
in parallel to your code and end your code, when the
user hits a key. I'm using a global stop boolean, which
is polled from any important subvi/substructure for
such cases.
Best regards
Gerd
Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019