当前位置: 首页>>代码示例>>Java>>正文


Java XBee.sendAtCommand方法代码示例

本文整理汇总了Java中com.rapplogic.xbee.api.XBee.sendAtCommand方法的典型用法代码示例。如果您正苦于以下问题:Java XBee.sendAtCommand方法的具体用法?Java XBee.sendAtCommand怎么用?Java XBee.sendAtCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rapplogic.xbee.api.XBee的用法示例。


在下文中一共展示了XBee.sendAtCommand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureEndDevice

import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
private void configureEndDevice(XBee xbee) throws XBeeException {
			
	// basic end device configuration (assumes ZNet radio flashed with end device API firmware)
	XBeeResponse response = null;
	
	// reset to factory settings
	response = xbee.sendAtCommand(new AtCommand("RE"));
	log.debug("RE is " + response);

	// set PAN id to arbitrary value
	response = xbee.sendAtCommand(new AtCommand("ID", new int[] {0x1a, 0xaa}));
	log.debug("ID is " + response);
	
	// set NI -- can be any arbitrary sequence of chars
	response = xbee.sendAtCommand(new AtCommand("NI", new int[] {'E','N','D','_','D','E','V','I','C','E','_','2' }));
	log.debug("NI is " + response);

	// set API mode to 2.  factory setting is 1
	response = xbee.sendAtCommand(new AtCommand("AP", 2));
	log.debug("AP is " + response);			

	// save to settings to survive power cycle
	response = xbee.sendAtCommand(new AtCommand("WR"));
	log.debug("WR is " + response);			

	// software reset
	response = xbee.sendAtCommand(new AtCommand("FR"));
	log.debug("FR is " + response);	
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:30,代码来源:ZNetApiAtExample.java

示例2: configureCoordinator

import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
private void configureCoordinator(XBee xbee) throws XBeeException {			
	// basic coordinator configuration (assumes ZNet radio flashed with COORDINATOR API firmware)
	XBeeResponse response = null;
	
	// reset to factory settings
	response = xbee.sendAtCommand(new AtCommand("RE"));
	log.debug("RE is " + response);

	// set PAN id to arbitrary value
	response = xbee.sendAtCommand(new AtCommand("ID", new int[] {0x1a, 0xaa}));
	log.debug("RE is " + response);
	
	// set NI
	response = xbee.sendAtCommand(new AtCommand("NI", new int[] {'C','O','O','R','D','I','N','A','T','O','R' }));
	log.debug("NI is " + response);

	// set API mode to 2.  factory setting is 1
	response = xbee.sendAtCommand(new AtCommand("AP", 2));
	log.debug("AP is " + response);			

	// save to settings to survive power cycle
	response = xbee.sendAtCommand(new AtCommand("WR"));
	log.debug("WR is " + response);			

	// software reset
	response = xbee.sendAtCommand(new AtCommand("FR"));
	log.debug("FR is " + response);	
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:29,代码来源:ZNetApiAtExample.java

示例3: configureIOSamples

import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
/**
 * This assumes an end device that is already has the configureEndDevice configuration
 * Does not save configuration! -- use WR if you want this configure to survive power on/off.
 * 
 * @param xbee
 * @throws XBeeException
 */
private void configureIOSamples(XBee xbee) throws XBeeException {			
	// basic coordinator configuration (assumes ZNet radio flashed with COORDINATOR API firmware)
	XBeeResponse response = null;
	
	// set IR to 1 sample every 10 seconds.  Set to 0 to disable
	response = xbee.sendAtCommand(new AtCommand("IR", new int[] {0x27, 0x10}));
	log.debug("IR is " + response);

	// set pin 20 to monitor digital input
	response = xbee.sendAtCommand(new AtCommand("DO", 0x3));
	log.debug("DO is " + response);

	// set pin 19 to monitor analog input
	response = xbee.sendAtCommand(new AtCommand("D1", 0x2));
	log.debug("D1 is " + response);
	
	// set pin 18 to monitor analog input
	response = xbee.sendAtCommand(new AtCommand("D2", 0x2));
	log.debug("D2 is " + response);
	
	// set pin 16 to monitor digital input
	response = xbee.sendAtCommand(new AtCommand("D6", 0x3));
	log.debug("D6 is " + response);
	
	// optionally configure DH + DL; if set to zero (default), samples will be sent to coordinator
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:34,代码来源:ZNetApiAtExample.java

示例4: associationStatus

import com.rapplogic.xbee.api.XBee; //导入方法依赖的package包/类
private void associationStatus(XBee xbee) throws XBeeException {
	// get association status - success indicates it is associated to another XBee
	AtCommandResponse response = (AtCommandResponse) xbee.sendAtCommand(new AtCommand("AI"));
	log.debug("Association Status is " + AssociationStatus.get(response));		
}
 
开发者ID:andrewrapp,项目名称:xbee-api,代码行数:6,代码来源:ZNetApiAtExample.java


注:本文中的com.rapplogic.xbee.api.XBee.sendAtCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。