ARDUINO 328 Functions Serial Link

From ROBOTC API Guide
Revision as of 21:02, 9 May 2012 by Tfriez (Talk | contribs)

Jump to: navigation, search
Functions and Variables → Serial Link


Color Key
Function:
Variable:


getChar

short getChar(const TUARTs nPort)
(short) Function will retrieve the next character from the buffer that was sent to port 'nPort'.


Parameter Explanation Data Type
nPort A sensor port or name TUARTs


getChar(uartOne);  // retrieve the next char from UART Port 'uartOne'


sendChar

void sendChar(const TUARTs nPort, short nChar)
(void) Function will send the next character to port 'nPort'.


Parameter Explanation Data Type
nPort A sensor port or name TUARTs
nChar A char to send to 'nPort'. (Can be a short or a char) short


sendChar(uartOne, 'B');  // send the next char from UART Port 'uartOne'


setBaudRate

void setBaudRate(const TUARTs nPort, TBaudRate nBaudRate)
(void) Function will set the Baud Rate for port 'nPort'.

Acceptable Baud Rates: 4800, 9600, 19200, 38400, 57600, 115200, 230400.


Parameter Explanation Data Type
nPort A sensor port or name TUARTs
nBaudRate The baud rate to use TBaudRate


setBaudRate(uartOne, baudRate9600);  // retrieve the next char from UART Port 'uartOne'