Hi,
I’m abandoning this way and will continue with an Arduino-board.
The solution you posted works in about 50% of the tests so it’s not reliable (at least it did so in my tests).
So it looks like it’s a problem with the software.
Using an Arduino-board I did not encounter any problems with this sensor.
AugustQ