I would not write here, not trying to sort out the problem on their own. There is one library, but it is still slower (link). The problem is not only this, but also in getting the temperature.
I think that the interruption could solve the problem.I found a solution for hardware port (Serial, link).
Here I would like to ask for help from the interrupt for the software port.
Other solutions to the problem, in addition to interrupt port, I do not see, unfortunately ![]()