• Kill switch and bump switch

    The “Kill switch” is to stop all actions on the robot if it is getting stuck somewhere or in some way out of control.  The “Kill switch” program must be defined before the “task main”  and then called to run once the “task main” has started.

    The bump switch is what is used to start the robot’s program and is defined once the program has started.

     

    task estop()                                    //this defines the function called
    {                                                   //estop (emergency stop)
    while(true)                                //continuous loop 
    {

    if(SensorValue[limit]==1)    //when the limit switch is pushed down

    {
    stopAllTasks();                  //stop everything (this is built in function for RobotC)
    }
    }
    }
    task main()                                   //Program begins, insert code within curly braces
    {
    startTask(estop);
    untilBump(bump);

    //then you start the rest of your program under this