0

I have a while loop (infinite) that reads different data from a sensor, sequentially and writes it to a file.

When I have the data printed to the screen there are certain scenarios where I wish to pause the loop so I can observe what anomaly or what be it is happening. I would like to do this by pressing spacebar, or whatever.

Here is a snippet of the program:

while True:

cmnd = getMsrMnt(filter.1020) #command to get a sensor value
if not cmnd.ok:
    print(cmnd.lastError)
else:
        print("The Si 1020 measure is {}".format(cmnd.numericValue*4)


cmnd = getMsrMnt(filter.900)
    if not cmnd.ok:
        print(cmnd.lastError)
    else:
        print("The Si 900 measure is {}".format(cmnd.numericValue*4)

cmnd = getMsrMnt(filter.989)
if not cmnd.ok:
        print(cmnd.lastError)
else:
    print("The Si 989 measure is {}".format(cmnd.numericValue*4)

Program stops via CTRL-C