Code: task main() { int CurrentX=0; int CurrentY=0; int CurrentAngle=0; nSchedulePriority=kHighPriority; StartTask(edgeDet); nSchedulePriority=kDefaultTaskPriority; int xPath[10] = {0,-10,0,0,0,0,0,0,0,0}; int yPath[10] = {0,-10,0,0,0,0,0,0,0,0}; int distance = 0; int angle = 0; //Cannot use due to firmware issues with //asin(), acos(), and atan() functions //built into the firmware of the NXT //GoToPoint(CurrentX, CurrentY, xPath[1],yPath[1], CurrentAngle); findAngle(distance, angle); if (angle<0) { angle=(angle-10); } else angle=(angle+10); turn(angle,CurrentAngle); moveDumb(distance); moveDumb(distance*-1); turn(angle * (-1),CurrentAngle); nxtDisplayTextLine(1,"Edge Found:%d",angle); nxtDisplayTextLine(2,"Distance:%d",distance); wait10Msec(1000); } |