整體是成功了完成發送端傳送"a"字元,經由中繼點轉傳"b"字元到終端節點,終端節點的終端機也有顯示"b"字元,剩下傳送速率的問題了
之前有練習過點對點完全不會有延遲的現象,但自從用了廣播模式後傳送跟接收無法完全同步,可能傳了四個字元還不會有延遲的現象,但超過4個之後就會發生延遲。
XCTU有設定相同PAND ID
請參考:不好意思沒 時間翻成中文 網頁請自搜
The above two methods separate entire networks, but if you have four XBee's in a multipoint situation, you still need a way to select which of the other three modules to talk to. This is why every Xbee has a 64-bit serial number programmed onto it that can be read out through the SL
(lower 4 bytes) and SH (upper 4 bytes) registers. Every node on the network knows each other's serial numbers or addresses.
So when Point A sends a packet to Point C, it includes Point C's address. All the modules in the network receive this and the microcontroller code compares the included number to their own.
If it matches, the data is for them. If not, the data is discarded.
Note that this must all be implemented by you in the software of the device you attach to the XBee. The XBee itself does not know who else is on the network or how to check the serial numbers.
即使在廣播模式 every Xbee 有獨特的編碼註冊 has a 64-bit serial number (Address) programmed onto it
----------------------------------------------
If you are using the API mode on these XBee chips (sure, if you use the XBee-api library), you do not need to include the address of the sender in the message.
This information is automatically specified in the frame. Have a look at the getRemoteAddress16() and getRemoteAddress64() methods in class ZNetRxBaseResponse .
So what you have to do, is send a first message "hello" i.e. to the Coordinator (which you can address easily as 0x0000) from the Node you want to know the address.
Using the above mentioned methods you can get this information.
int statusLed = 10;
int errorLed = 11;
uint8_t option = 0;
uint8_t data = 0;
void flashLed( int pin, int times, int wait ) {
for( int i = 0; i < times; i++ ) {
digitalWrite( pin, HIGH ); delay( wait ); digitalWrite( pin,
LOW );
if( i + 1 < times ) delay( wait );
}
}