Let's Make Robots!

Need help for mapping and edge detection for traversing of my robot.

My bot consists of 3 IR sensor,,,two fixed in two sides f the front and one on the servomotor at the middle top. I wrote this arduino program to detect a gap among some obstacles for my bot to pass through. Please tel me where i am going wrong or whether my logic s correct or not???


#include  <Servo.h>


Servo myservo;

int pos=0;

int dist[17];


int STBY = 10; 

int PWMA = 3; 

int AIN1 = 9; 

int AIN2 = 8; 

int PWMB = 5;

int BIN1 = 11;

int BIN2 = 12;