帮助:如何使用visual studio c ++与ZIGBEE传输数据
两个xbee系列2: XBEE 1连接到PC(将数据传输到我的其他xbee) XBEE 2 - 接收数据;连接到LCD。
提前致谢。
答案 0 :(得分:1)
要使用PC上连接的XBee,您需要:
答案 1 :(得分:0)
void XBee::XBeeOpen(String^ PortCom)
{
// very short exemple of in a XBee Class
try
{
SerialLink->PortName = PortCom;
}
catch (Exception^ e)
{
.....
}
SerialLink->BaudRate = 115200;
SerialLink->Parity = Parity::None;
SerialLink->StopBits = StopBits::One;
SerialLink->DataBits = 8;
SerialLink->Handshake = Handshake::None;
// Set the read/write timeouts
// SerialLink->ReadTimeout = SerialPort::InfiniteTimeout;
// SerialLink->WriteTimeout = SerialPort::InfiniteTimeout;
SerialLink->ReadTimeout = 20;
SerialLink->WriteTimeout = 20;
// Encoding
SerialLink->Encoding = System::Text::Encoding::GetEncoding(28591);
if ( !SerialLink->IsOpen )
SerialLink->Open();
SerialLink->BreakState = false;
SerialLink->DiscardNull = false;
Opened = SerialLink->IsOpen;
}
//---------------------------------------------------------------------------
void XBee::XBeeClose(void)
{
if (SerialLink->IsOpen )
SerialLink->Close();
Opened = SerialLink->IsOpen;
}