User manual
ASURO - 64
-
C for ASURO
9.1.7. Pointers and vectors
Pointers and vectors will be described to an extent, needed for the ASURO-operations.
If we need to track data from the line tracing sensors or odometric sensors we will need vectors.
Their declaration is rather simple:
int lineData[2];
int odometrieData[2];
As you will recognize we will create two vectors (lData, oData) with 2 elements for linetracing and
for odometrics. By calling ASURO Function (LineData(), OdometrieData ()) element [0] receives
the value of the left sensor and element [1] receives the value of the right sensor.
We will demonstrate this method in an example:
If the right sensor receives more light than the left sensor, command1 should be executed
otherwise command2.
int lData[2]; // Provide memory space for measurement results
LineData(lData); // Reading measurement data
if (lData[1] > lData[0])
command1;
else
command2;
To use the serial interface functions (
SerWrite (), SerRead () ) we need character strings. These
will be declared as follows:
char message[] = “This is a text string”
In order to send a text string in ASURO, a function SerWrite() is called with appropriate
parameters. The rst parameter contains the text string or the variable containing the text string,
the second variable describes the number of characters to be sent, eg.:
SerWrite(message,20);
respectively
SerWrite(„This is a text“,14);
will transmit a message “This is a text” over the IR-Interface.