flange_serial_close
This function closes the flange serial transfer port in the robot controller.
Definition
DRFLEx.h within class CDRFLEx, public section
bool flange_serial_close(int nPort)
{
return _flange_serial_close(_rbtCtrl, nPort);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
nPort |
int |
Serial port index |
Return
Value |
Description |
|---|---|
0 |
Error: failed to close serial port. |
1 |
Success: serial port successfully closed. |
Note
The flange board revision used by the flange serial and flange I/O functions is read at open_connection.
Example
char buf[] = "test123";
Drfl.flange_serial_open(1, 115200);
Drfl.flange_serial_write(7, buf, 1);
LPFLANGE_SER_RXD_INFO_EX temp = Drfl.flange_serial_read(4.5, 1);
printf("Serial read : %.*s\n", temp->_iSize, (const char*)temp->_cRxd);
printf("Serial cnt : %d\n", temp->_iSize);
Drfl.flange_serial_close(1);
This example first opens the flange serial port, sends test data, reads incoming data using flange_serial_read(), and finally closes the connection using flange_serial_close() to safely release the port resource.