void interruptions_left(void) //for interruptions appearing on the left to the track { straight_fwd(); // Go forward Delay10KTCYx(130); check_sensors(); if (SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //10100 { while(SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 sees nothing { //spin right spin_right(); check_sensors(); } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&SeeLine.b.Right) //00101 { straight_fwd(); // Go forward Delay10KTCYx(130); check_sensors(); if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { spin_right(); check_sensors(); } } } * }
void final_ends(void) //stops robot when it comes to black platform { straight_fwd(); //go straight Delay10KTCYx(150); //0.1875s check_sensors(); //constantly keeps checking to see LED combinations while(SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right) //11111 //all LEDs ON { motors_brake_all(); //stops all motor check_sensors(); //constantly keeps checking to see LED combinations } }
void go_straight(void) { // very simple motor control if ( SeeLine.b.Center ) straight_fwd(); else if (SeeLine.b.Left) spin_left(); else if (SeeLine.b.CntLeft) turn_left(); else if (SeeLine.b.CntRight) turn_right(); else if (SeeLine.b.Right) spin_right(); if ( (SeeLine.B ) == 0b00000u) motors_brake_all(); }
void Check_Gaps(void) //checks gaps and makes a 180 degree turn after going about 8cm (needs to be exact.) { int sensor_check = 0; //variable sensor check for(sensor_check; sensor_check < 10; sensor_check++) //executes 20 times, looking for gaps in each count. { check_sensors(); //constantly keeps checking for LED combinations if ( (SeeLine.B ) == 0b00000u) //all LEDs OFF { straight_fwd(); //go straight Delay10KTCYx(20); //0.025s OR 25ms. if( sensor_check == 9) //last condition { turn_180 (); straight_fwd(); } } else { sensor_check = 9; } } }
void sharp_turns(void) { if( (SeeLine.B)==0b00100u) { if( (SeeLine.B)==0b10100u) spin_left(); } else if( (SeeLine.B)==0b00100u) { if( (SeeLine.B)==0b00101u) spin_right(); } else straight_fwd(); }
void sharp_left_turns(void) //sharp left turns { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations } } else if (SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//10100 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004); check_sensors(); //constantly keeps checking to see LED combinations } } } //WE ADDED THIS LINE TO SEE IF IT MAKES A DIFFERENCE (ADDED IN v008) else if (SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//11100 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations } } } //THIS LINE FUNCTION ENDS HERE else if (SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//11000 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004); check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//01000 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right)//01110 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00100 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right)//00110 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//01100 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//0000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations. } } } else; }
void sharp_right_turns(void) //sharp right turns { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 sees nothing { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&SeeLine.b.Right) //00101 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations. } } } //THIS WAS ADDED IN v008 else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right)//00111 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations } } } //FUNCTION STOPS HERE else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right) //00011 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right)//00010 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations. } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right)//01110 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00100 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//01100 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_right(); //spins right check_sensors(); //constanlty keeps checking to see LED combinations } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right)//00110 { straight_fwd(); //go straight Delay10KTCYx(130); //Changed from Delay10KTCYx(50); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations. } } } else; }
void motor_control(void) //Different scenerios that will light up the LEDs in a certain way, //and the motor reactions to the scenarios. { if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) straight_fwd(); //00100 else if (SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) spin_left(); //10000 else if (SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) spin_left(); //11000 else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) turn_left(); //01000 else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) turn_left(); //01100 else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right) turn_right();//00010 else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right) turn_right(); //00110 else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&SeeLine.b.Right) spin_right();//00001 else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right) spin_right(); //00011 else if ( (SeeLine.B ) == 0b00000u) Check_Gaps(); //00000 //all LEDs OFF else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right) right_right_angle_turns(); //00111 else if (SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) left_right_angle_turns(); //11100 else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&SeeLine.b.Right) sharp_right_turns(); //00101 else if (SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) sharp_left_turns(); //10100 else if (SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right) merge_right(); //10010 else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&SeeLine.b.Right) merge_left(); //01001 else if (SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right) merge_right(); //11010 else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right) merge_left(); //01011 else if (SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right) final_ends(); //11111 //all LEDs ON }
void left_right_angle_turns(void) //left right angle turns, if else cases cover sharp turns aswell { straight_fwd(); //go straight Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if ( (SeeLine.B ) == 0b00000u) //all LEDS OFF { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004) check_sensors(); //constantly keeps checking to see LED combinations. } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//01000 { straight_fwd(); Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004). check_sensors(); //constantly keeps checking to see LED combinations. } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right)//01110 { straight_fwd(); //go straight Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004). check_sensors(); //constantly keeps checking to see LED combinations. } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00100 { straight_fwd(); //go straight Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spin right in v004). check_sensors(); //constantly keeps checking to see LED combinations. } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//01100 { straight_fwd(); //go straight Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right)//00000 { spin_left(); //spins left (was spins right in v004); check_sensors(); //constantly keeps checking to see LED combinations. } } } else; } }
void right_right_angle_turns(void) //right right angle turns, if-else cases cover sharp turns as well { straight_fwd(); Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if ( (SeeLine.B ) == 0b00000u) //all LEDs OFF. { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //while all off; 00000 { spin_right(); //spins the robot right. check_sensors(); //constantly keeps checking to see LED combinations. } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right) //00010 { straight_fwd(); //go straight Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { spin_right(); //spins the robot right. check_sensors(); //constantly keeps checking to see LED combinations. } } } else if (!SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right) //01110 { straight_fwd(); //Go straight. Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { spin_right(); //Rotates Right check_sensors(); //constantly keeps checking to see LED combinations. } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00100 { straight_fwd(); //Go straight. Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //contantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { spin_right(); //spins right check_sensors(); //constantly keeps checking to see LED combinations. } } } else if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&!SeeLine.b.Right) //00110 { straight_fwd(); //Go straight. Delay10KTCYx(50); //Changed from Delay10KTCYx(25); (v 009) check_sensors(); //constantly keeps checking to see LED combinations. if (!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { while(!SeeLine.b.Left&&!SeeLine.b.CntLeft&&!SeeLine.b.Center&&!SeeLine.b.CntRight&&!SeeLine.b.Right) //00000 { spin_right(); //Rotates right. check_sensors(); //constantly keeps checking to see LED combinations. } } } else; }