Project

irtoy

0.0
No commit activity in last 3 years
No release in over 3 years
A gem for transmitting and receiving infrared signals from an IR Toy. Heavily inspiered by https://github.com/crleblanc/PyIrToy and https://github.com/djellemah/irtoy-hexbug-spider .
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.2.4
 Project Readme

IRToy

A ruby gem for transmitting and receiving infrared signals from an IR Toy. This requires the Dangerous Prototype USB IR Toy (http://dangerousprototypes.com/docs/USB_Infrared_Toy) with firmware revision 22 or higher.

This gem has been tested with Ruby 2.1.5 and 2.2.1 on Mac OS X Yosemite. There is no OS specific code in this gem, so it should work on Mac OS, Linux and Windows but has not been tested.

This gem is available on RubyGems (https://rubygems.org/gems/irtoy) and can be installed with bundler or the following command:

gem install irtoy

This gem makes it easy to transmit to and receive from an IR Toy.

Usage

Object creation

require 'irtoy'

irtoy = IRToy.new(
  skip_versioncheck: true,    # optional, default false
  baud:              115200,  # optional
  max_write_size:    32,      # optional, shouldn't be more
  sleep_time:        0.1,     # optional, shouldn't be less
)

Version stuff

> irtoy.version
=> "V222"
> irtoy.firmware_version
=> 22
> irtoy.hardware_version
=> "V2"

Receiving

> ir_code = irtoy.receive
# *button press on fan remote*
=> [0, 58, 0, 20, 0, 58, 0, 20, 0, 19, 0, 58, 0, 59, 0, 20, 0, 58, 0, 20, 0, 19, 0, 58, 0, 20, 0, 59, 0, 19, 0, 58, 0, 19, 0, 59, 0, 19, 0, 59, 0, 59, 0, 20, 0, 18, 1, 119, 0, 58, 0, 21, 0, 57, 0, 21, 0, 18, 0, 59, 0, 58, 0, 21, 0, 57, 0, 21, 0, 17, 0, 60, 0, 19, 0, 59, 0, 19, 0, 58, 0, 20, 0, 59, 0, 19, 0, 58, 0, 57, 0, 22, 0, 19, 1, 118, 0, 57, 0, 22, 0, 56, 0, 22, 0, 19, 0, 58, 0, 57, 0, 22, 0, 56, 0, 22, 0, 19, 0, 58, 0, 20, 0, 58, 0, 20, 0, 58, 0, 20, 0, 58, 0, 20, 0, 58, 0, 57, 0, 22, 0, 18, 1, 120, 0, 56, 0, 22, 0, 56, 0, 22, 0, 17, 0, 60, 0, 56, 0, 22, 0, 56, 0, 22, 0, 17, 0, 60, 0, 20, 0, 58, 0, 19, 0, 58, 0, 19, 0, 59, 0, 18, 0, 60, 0, 56, 0, 22, 0, 17, 255, 255]

Transmitting

ir_code = 0, 58, 0, 20, 0, 58, 0, 20, 0, 19, 0, 58, 0, 59, 0, 20, 0, 58, 0, 20, 0, 19, 0, 58, 0, 20, 0, 59, 0, 19, 0, 58, 0, 19, 0, 59, 0, 19, 0, 59, 0, 59, 0, 20, 0, 18, 1, 119, 0, 58, 0, 21, 0, 57, 0, 21, 0, 18, 0, 59, 0, 58, 0, 21, 0, 57, 0, 21, 0, 17, 0, 60, 0, 19, 0, 59, 0, 19, 0, 58, 0, 20, 0, 59, 0, 19, 0, 58, 0, 57, 0, 22, 0, 19, 1, 118, 0, 57, 0, 22, 0, 56, 0, 22, 0, 19, 0, 58, 0, 57, 0, 22, 0, 56, 0, 22, 0, 19, 0, 58, 0, 20, 0, 58, 0, 20, 0, 58, 0, 20, 0, 58, 0, 20, 0, 58, 0, 57, 0, 22, 0, 18, 1, 120, 0, 56, 0, 22, 0, 56, 0, 22, 0, 17, 0, 60, 0, 56, 0, 22, 0, 56, 0, 22, 0, 17, 0, 60, 0, 20, 0, 58, 0, 19, 0, 58, 0, 19, 0, 59, 0, 18, 0, 60, 0, 56, 0, 22, 0, 17, 255, 255]

irtoy.transmit ir_code

# *fan starts*

Acknowledgement

This gem is heavily inspiered by https://github.com/crleblanc/PyIrToy and https://github.com/djellemah/irtoy-hexbug-spider . Huge thanks to @crleblanc and @djellemah for the inspiration.

License

The code is released under the GPL 3. See the LICENSE file for further information.