(Mar-03-2018, 09:08 PM)Larz60+ Wrote: what is the device that you are using, raspberry pi, arduino? I'm thinking there must be a way to trigger an interrupt (event in python) when there is a charater in the UART buffer. Tell me device you are using, and type of serial (i2c, usart, spi, etc.) Once I know this, I can look at your available options.Hi
I'm reading from uart (tx rx) of raspberry pi gpio.
Is there a trigger?
In the serial uart I'm reading the bytes sent from a NEXTION touch display (if this is important)
(Mar-03-2018, 09:33 PM)marsokod Wrote: You may want to use a thread or a process depending on what your function1 and function2 are doing. You can either start them manually, use a library like APScheduler to have a pool of threads/process and add your function to the job queue, or start thread/processes at the beginning of your code and have them read elements in a queue. In the last case, your ReadSerial function would only have to put an element in a queue, which should minimize any interruption to the monitoring.
Function1() acquires sensor data and show it on lcd
Function2() is the same as 1 but also writes the data to a text file
So threading?