Project

xbee-ruby

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby API for Digi XBee RF Modules
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 1.3.0
>= 10.0.0
>= 2.14.0
>= 0.8.0

Runtime

>= 1.1.0
 Project Readme

XBee Ruby

A Ruby API for XBee ZigBee-RF-Modules

I developed this gem for my CoYoHo Home Automation System. Only a small part of the XBee-API is currently implemented. Especially only Series-2 modules in API-mode 2 and a subset of the available frame types are supported.

Example: Transmit a packet to another node

xbee = XBeeRuby::XBee.new port: '/dev/ttyUSB0', rate: 57600
xbee.open
request = XBeeRuby::TxRequest.new  XBeeRuby::Address64.new(0x00, 0x13, 0xa2, 0x00, 0x40, 0x4a, 0x50, 0x0c), [0x12, 0x34, 0x56]
xbee.write_request request
puts xbee.read_response
xbee.close

Example: Receive packets

xbee = XBeeRuby::XBee.new port: '/dev/ttyUSB0', rate: 57600
xbee.open
while true do
	response = xbee.read_response
	case response
		when XBeeRuby::RxResponse
			puts "Received from #{response.address64}: #{response.data}"
		else
			puts "Other response: #{response}"
	end
end

Supported frame types

Requests

  • 0x10 TxRequest

Responses

  • 0x8b TxResponse
  • 0x90 RxResponse

License

The xbee-ruby code is licensed under the the MIT License

You find the license in the attached LICENSE.txt file