Main idea . Serial port interruptions are rare, so they should not affect the continuous cycle of the pressure regulator. Here is a piece of code with interruption from an incoming message, parsing of an incoming control line, and reading of an analog port.

Revision:
0:342c0ede45d5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Thu Apr 09 22:38:58 2020 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*