Ian W.
14-02-2004, 13:28
I'm rewriting the navigate.c class for our team, and I've come to an annoying problem.
I have two sensors, left and right, for each side of the robot. Depending on a switch, only one should be read. That means I can save on code, I think.
With PBASIC, a simple if statement and alias command would set "sensor" to "left_sensor" or "right_sensor" but I have no idea how to do this in C, without going into pointers (which I don't remember).
Is there any way I can make a conditional #define (or similar) statement?
I have two sensors, left and right, for each side of the robot. Depending on a switch, only one should be read. That means I can save on code, I think.
With PBASIC, a simple if statement and alias command would set "sensor" to "left_sensor" or "right_sensor" but I have no idea how to do this in C, without going into pointers (which I don't remember).
Is there any way I can make a conditional #define (or similar) statement?