NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
ex_joystickmsg.nxc

This is an example of how to use the JoystickMessageRead function along with the JoystickMessageType structure.

/*
struct JoystickMessageType {
byte JoystickDir;
byte LeftMotor;
byte RightMotor;
byte BothMotors;
char LeftSpeed;
char RightSpeed;
unsigned long Buttons;
};
*/
task main()
{
while (true)
{
char result = JoystickMessageRead(MAILBOX1, jmt);
if (result == NO_ERR)
{
}
else
NumOut(0, LCD_LINE8, result);
}
}