function Back(a) local x = {} local dmax,dmin local LP,GL,xLP local dcount = 0 local ret = 0 local glret = 0 local GL = 0 local i = 1 local wcount = 0 local YStat = 0 local sharp = {} local DriveBy = 0 motor(0,a,0,a+1) repeat x[1],x[2],x[3],x[4],x[5] = snabel() x[1] = ((x[1] - cs1) * 1000) / (ch1-cs1) x[2] = ((x[2] - cs2) * 1000) / (ch2-cs2) x[3] = ((x[3] - cs3) * 1000) / (ch3-cs3) x[4] = ((x[4] - cs4) * 1000) / (ch4-cs4) x[5] = ((x[5] - cs5) * 1000) / (ch5-cs5) wcount = 0 i = 1 repeat if x[i] < 600 then wcount = wcount + 1 end i = i + 1 until i == 6 if wcount > 4 then motor(0,0,0,0) return end until ccheck() motor(0,0,0,0) print("Samples "..dcount) end