简体   繁体   English

XBee S1从API模式读取值

[英]XBee S1 read values from API mode

I have two XBees S1-one attached to a temperature sensor. 我有两个XBees S1,一个连接到温度传感器。 This Xbee reads analog values, converts them into digital values thanks to the ADC and transmits them. 该Xbee读取模拟值,借助ADC将其转换为数字值并进行传输。 The other XBee - the receiver, is connected to a computer via a USB Explorer. 另一个XBee-接收器通过USB Explorer连接到计算机。 This XBee works in API mode. 该XBee在API模式下工作。 The XBee connected to a computer receives the data send by the transmitter. 连接到计算机的XBee接收发送器发送的数据。 I monitor the received values with the X-CTU software, version 6.2.0. 我使用X-CTU软件6.2.0版监视接收到的值。 Up until this point, everything works fine. 到目前为止,一切正常。

However, the problem that I encounter is that the data received on the computer is coded: there are bits corresponding to the address of the receiver, bits corresponding to the address of the sender, the data itself, acknowledgment bits,etc. 但是,我遇到的问题是计算机上接收到的数据是经过编码的:有些位对应于接收方的地址,有些位对应于发送方的地址,数据本身,确认位等。 My question is how can I extract only the data bits without all th other information send by the transmitter? 我的问题是我如何才能仅提取数据位,而无需由发送器发送所有其他信息?

I tried to read the values with a USB to TTL cable, connecting this cable to the Tx , Rx , GND and 5V (there is a 5V input in the USB Explorer despite that the XBee works at 3.3V) of the receiver XBee and using the screen command in Linux. 我尝试使用USB转TTL电缆读取值,将该电缆连接到接收器XBee的TxRxGND5V (尽管USB X Explorer在3.3V电压下,USB Explorer中有5V输入)并使用在Linux中使用screen命令。 However, in this way I receive ASCII characters and I want to receive the binary code. 但是,通过这种方式,我接收ASCII字符,并且希望接收二进制代码。 I want to put those values in a database in order to be able to treat them later. 我想将这些值放在数据库中,以便以后可以使用它们。

Thank you for your assistance. 谢谢您的帮助。

With a library like this one , you can use function to get the data from your Xbee in python ;) (if you use linux) 有了这样一个图书馆这一个 ,你可以使用函数从Python中你的XBee获取数据;)(如果你使用Linux)

You just have to initialise the port (should be on /dev/tty...) and than catch the data with a loop which check if new data is coming. 您只需要初始化端口(应该在/ dev / tty ...上),然后用一个循环捕获数据即可,该循环检查是否有新数据传入。

If you need more help I can send you part of my code (doesn't have it near me, it's on my raspy) 如果您需要更多帮助,我可以向您发送部分代码(没有在我附近的代码,这是在我的粗暴中)

I hope I've help you ;) Thana 希望我能帮助您;)塔娜

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM