Some of the uses for the #define statement, not all necessarily good programming but it shows that it has other uses beyond just defining constants. More explanation here
http://en.wikipedia.org/wiki/C_preprocessor
Code:
#pragma config(UART_Usage, UART1, VEX_2x16_LCD, baudRate19200, IOPins, None, None)
#pragma config(Motor, port1, , tmotorNormal, openLoop)
#pragma config(Motor, port2, , tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#define DEBUG
#define ABS(x) ( (x)>=0?(x):-(x) )
#define DRIVE_MOTOR(x) do{\
motor[port1] = (x);\
motor[port2] = (x);\
}while(0)
#define JOY_DRIVE vexJSLeftV
#define DISPLAY_MOTORS do{\
displayLCDNumber(1, 0, motor[port1], 3);\
displayLCDNumber(1, 8, motor[port2], 3);\
}while(0)
task main()
{
while(true)
{
DRIVE_MOTOR( vexRT[ JOY_DRIVE ] );
wait1Msec(20);
#ifdef DEBUG
DISPLAY_MOTORS;
#endif
}
}