Can someone help me with my code for an obstacle avoiding robot

Hello and welcome. Please take a few minutes and read How to get the best out of this forum. If you follow the recommendations there, you will make it much easier for others to help you. Right now, you're making it more difficult.