====== comPrint ======
''void comPrint (u8 comCh, char* comString[, arg0, ..., argn] )''
|comCh : Channel number |
|comString : String of characters to transmit |
Transmits a string of characters, comString, on channel comCh.
#include "moacon500.h"
void cmain(void)
{
openCom(0, 115200, C8N1); // Channel 0, 115200 Baud, data bits: 8, no parity, stop bits: 1
while (1) // Repeat forever
{
delay(500); // Wait for 500ms
comPrint(0, "abc\r\n"); // Transmits "abc" and a new line
}
}
comString can be specified as a string literal by surrounding text in quotes. In the example above, "abc" is
the text, and "\r\n" are carriage return and new line characters respectively so each "abc" appears on a
new line.
Like the printf function comPrint may optionally contain format specifiers that are substituted by the
additional arguments (arg0,…, argn).
comPrint(0, "2 + 1 = %d", 2+1); // Transmits "2 + 1 = 3" on channel 0
[[MOACON:index#System_Library:|go MOACON home]]