flange_serial_write
This is a function for sending serial data through the flange serial port in the robot controller.
The port parameter is only available in the new flange version (v2).
Definition
DRFLEx.h within class CDRFLEx, public section (line 878)
bool flange_serial_write(int nSize, char* pSendData, int nPort = 1)
{
return _flange_serial_write(_rbtCtrl, nSize, pSendData, nPort);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
nSize |
int |
Size of the transmission buffer (RX data size). |
|
pSendData |
char* |
Pointer to the data buffer to be sent. Maximum supported size: 256 bytes. |
|
nPort |
int |
1 |
Port number for flange serial interface |
Return
Value |
Description |
|---|---|
0 |
Error — failed to transmit data. |
1 |
Success — data successfully transmitted. |
Example
Drfl.flange_serial_open(115200);
Drfl.flange_serial_write(8, "test123");
LPFLANGE_SER_RXD_INFO temp = Drfl.flange_serial_read(4, 5);
cout << "Serial read : " << temp->_pRxd << endl;
cout << "Serial cnt : " << (int)temp->_iSize << endl;
Drfl.flange_serial_close(0);
This example opens the flange serial port, sends an 8-byte test message, reads back received data using flange_serial_read(), and finally closes the port. It demonstrates basic send/receive flow for flange serial communication.