Efficient and fast Python While loop while using sleep()

前端 未结 3 1068
日久生厌
日久生厌 2021-01-31 17:16

I am attempting to communicate with a device over serial using Pyserial. As commands need to be continually sent, they have to be placed in a while loop in Python.

I am

3条回答
  •  暖寄归人
    2021-01-31 17:35

    You have to figure out the tradeoff you are willing to have between speed and CPU load.

    If you have to send short bursts of data, while not doing so much between messages, then maybe you can live with high CPU load for a short time as the average might still be low.

提交回复
热议问题