1+ #include " pros/competition.hpp"
2+ #include " pros/rtos.hpp"
3+
4+ #include < stdint.h>
5+
6+ extern " C" {
7+ void vexDisplayPrintf (int32_t xpos, int32_t ypos, uint32_t bOpaque, const char * format, ...);
8+ void vexDisplayErase ();
9+ }
10+
11+ int main () {
12+ zest::competition::register_driver_control ([]() {
13+ vexDisplayErase ();
14+ vexDisplayPrintf (10 , 100 , 1 , " Driver Control Running\n " );
15+ vexDisplayPrintf (10 , 60 , 1 , " num tasks: %u\n " , pros::Task::get_count ());
16+ // infinite loop to test task priorities. If everything is working correctly, the
17+ // competition task will still switch when the competition state changes
18+ while (true ) {
19+ asm (" nop" );
20+ }
21+ });
22+ zest::competition::register_autonomous ([]() {
23+ vexDisplayErase ();
24+ vexDisplayPrintf (10 , 100 , 1 , " Autonomous Running\n " );
25+ vexDisplayPrintf (10 , 60 , 1 , " num tasks: %u\n " , pros::Task::get_count ());
26+ // infinite loop to test task priorities. If everything is working correctly, the
27+ // competition task will still switch when the competition state changes
28+ while (true ) {
29+ asm (" nop" );
30+ }
31+ });
32+ zest::competition::register_disabled ([]() {
33+ vexDisplayErase ();
34+ vexDisplayPrintf (10 , 100 , 1 , " Disabled Running\n " );
35+ vexDisplayPrintf (10 , 60 , 1 , " num tasks: %u\n " , pros::Task::get_count ());
36+ // infinite loop to test task priorities. If everything is working correctly, the
37+ // competition task will still switch when the competition state changes
38+ while (true ) {
39+ asm (" nop" );
40+ }
41+ });
42+
43+ vexDisplayPrintf (10 , 60 , 1 , " demonstrating that tasks are run after main returns\n " );
44+ pros::delay (3000 );
45+ vexDisplayErase ();
46+ }
0 commit comments