User manual

ASURO - 60
-
C for ASURO
If the program should be able to choose one option out of several alternatives, you may use
several “else if”-constructs.
if (Condition1)
Command_block_1
else if (Condition2)
Command_block_2
else if (Condition3)
Command_block_3
else if (Condition4)
Command_block_4
else
Command_block_5
The following conditional structures may be used:
Example:
#include “asuro.h”
int main(void) {
while (1) {
if (PollSwitch()>0) {StatusLED(RED);}
else {StatusLED(GREEN);}
}
}
If one of the collision detector switches has been activated, the status-LED will be switched on red,
otherwise in green. The other programming code will be explained later.
In the C-language a value “1” represents true and “0” represents false.
The conditional statement:
if (0) {StatusLED(RED);}
of course implies the command StatusLED(RED) will never be executed.
Operator
Explanation
==
comparision for equal
!=
comparision for unequal
<
comparision for less
>
comparision for greater
<=
comparision for less or equal
>=
comparision for greater or equal