Code: #include "JoystickDriver.c";
task main { bDisplayDiagnostics = false;
while(true) { getJoystickSettings(joystick);
//display joystick state //analog sticks nxtDisplayTextLine(0, "x1:%4d, y1:%4d", joystick.joy1_x1, joystick.joy1_y1); nxtDisplayTextLine(1, "x2:%4d, y2:%4d", joystick.joy1_x2, joystick.joy1_y2); //buttons nxtDisplayTextLine(2, "%2s %2s %2s %2s", joy1Btn(1) ? "1" : "", joy1Btn(2) ? "2" : "", joy1Btn(3) ? "3" : "", joy1Btn(4) ? "4" : ""); nxtDisplayTextLine(3, "%2s %2s %2s %2s", joy1Btn(5) ? "5" : "", joy1Btn(6) ? "6" : "", joy1Btn(7) ? "7" : "", joy1Btn(8) ? "8" : ""); nxtDisplayTextLine(4, "%2s %2s %2s %2s", joy1Btn(9) ? "9" : "", joy1Btn(10) ? "10" : "", joy1Btn(11) ? "11" : "", joy1Btn(12) ? "12" : ""); //tophat nxtDisplayTextLine(5, "Tophat: %d", joystick.joy1_TopHat); //mode info nxtDisplayTextLine(6, "%s", joystick.UserMode ? "Tele-Op" : "Autonmous"); nxtDisplayTextLine(7, "%s", joystick.StopPgm ? "Stopped" : "Started"); }
} |