RP6 ROBOT SYSTEM - 4. RP6 CONTROL M256 WIFI Library
In order to make the processing of text replies from the WLAN module easier, the fol-
lowing function allows to recognize and analyze individual lines:
uint8_t parseLine_WIFI(uint8_t data)
It must be called in a loop and every individual character must be passed to it. The re-
turn values of the function show if a complete line has been read. The line is stored in
a buffer (= array) can can be processed further once it is complete.
The return value is:
0 if no complete text line has been recognized,
1 if a line delimiter has been recognized and
2 if the buffer was too small (everything that fitted in the buffer can still be read).
Standard is 254 characters.
The buffer is defined as
char receiveBuffer_WIFI[256]
and can be normally used in your own program.
The following simple example displays all text lines received from the WLAN module
on the serial interface:
while(true)
{
if(getBufferLength_WIFI()) // Received any data?
{
if(parseLine_WIFI(readChar_WIFI())) // Whole line?
{
writeString("\nReceived following text: ");
writeString(receiveBuffer_WIFI);
}
}
}
If you now establish a connection to the module, you can enter text in the network
terminal and send it. The text should then appear in the serial terminal. Of course you
need to open the serial interface first.
- 40 -