/////////////////////////////////////////////////////////////////////////////////////// // // Autonomous Task // // This task is used to control your robot during the autonomous phase of a VEX Competition. // You must modify the code to add your own robot specific commands here. // ///////////////////////////////////////////////////////////////////////////////////////// task autonomous() { //StopTask(Menu); switch(count) { case 0: { autonomous0(); break; } case 1: { autonomous1(); break; } case 2: { autonomous2(); break; } case 3: { autonomous3(); break; } case 4:{ programming(); break; } } }
void *student_loop(void *param) { int number = *((int *)param); //dereference *param as an integer int sleep_time; while(1) { srandom((unsigned)time(NULL)); sleep_time = (int)((random() % MAX_SLEEP_TIME) + 1); printf("Student %d is programming\n", number); programming(sleep_time); pthread_mutex_lock(&chair_mutex); //check if space available if (seats_occupied < MAX_WAITING_STUDENTS) { //ask for help from TA sem_post(&students_waiting); seats_occupied++; printf("Student %d asked for help. Students waiting: %d\n", number, seats_occupied); } pthread_mutex_unlock(&chair_mutex); } return NULL; }
task autonomous() { // Turn The LCD Backlight On bLCDBacklight = true; // Naming Convention, Due to Multiple Counts Running int finalCount = count; // Set The Intake to Open SensorValue[dumpCubes] = 0; //Stop The Menu Task stopTask(Menu); //Consult The Menu Class to Run Autonomous Mode switch (finalCount) { case 0: { autonomous0(); break; } case 1: { autonomous1(); break; } case 2: { autonomous2(); break; } case 3: { autonomous3(); break; } case 4: { autonomous4(); break; } case 5: { autonomous5(); break; } case 6: { autonomous6(); break; } case 7: { autonomous7(); break; } case 8: { autonomous8(); break; } case 9: { autonomous9(); break; } case 10: { autonomous10(); break; } case 11: { autonomous11(); break; } case 12: { autonomous12(); break; } case 13: { autonomous13(); break; } case 14: { autonomous14(); break; } case 15: { autonomous15(); break; } case 16: { testing(); break; } case 17: { programming(); break; } } }