Help please to improve this obstacle avoiding robot project.

I still can´t make the code work on my robot. Any help is more than welcome.