简体   繁体   English

使用Java与XBee模块进行通信

[英]Communicating with an XBee module using Java

I want to connect my xbee-api-0.9 module Java and communicate with it by sending AT commands. 我想连接我的xbee-api-0.9模块Java并通过发送AT命令与之通信。

import com.rapplogic.xbee.api.XBee;
import com.rapplogic.xbee.api.XBeeException;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class Xbee_1 {
    private final static Logger log = Logger.getLogger(Xbee_1.class);
    public static void main( String []args){
        PropertyConfigurator.configure("log4j.properties");
        XBee xbee = new XBee();
        try {
            xbee.open("COM34", 9600);
        } catch (XBeeException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            System.out.println("nepeut pas s'ouvr");
        }
        System.out.println("ok");
    }
}

Digi has an Open Source Java library to interface with their XBee modules. Digi具有一个开放源Java库 ,可以与其XBee模块进行接口。 It was announced earlier this year. 它是今年早些时候宣布的 I suggest that you use that as your starting point. 我建议您以此为起点。

Creating XBee applications just got way easier. 创建XBee应用程序变得更加容易。 Gone are the days of toiling away for every inch of code. 每一寸代码辛苦劳作的日子已经一去不复返了。 In order to make it as simple as possible for you to write applications that interact with XBee, we have created the XBee Java Library. 为了使编写与XBee交互的应用程序的过程尽可能简单,我们创建了XBee Java库。 This library supports ZigBee, 802.15.4, DigiMesh and Point-to-Multipoint XBee devices! 该库支持ZigBee,802.15.4,DigiMesh和点对多点XBee设备!

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

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