Hi,
thanks a lot, it was very useful.
As for the first problem, I solved it by moving by small steps and checking whether there is something underneath the sensor after each step. The movement is minced and it causes some vibrations, but it achieves desired results. I am still open to any suggestions and once again, thank you for help.
Michal