No commit activity in last 3 years
No release in over 3 years
This Rubygem provides a wrapper for IR-Learning-Remote that has been built using the Arduino. Please setup Arduino -> https://github.com/shokai/arduino_ir_remote
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

Arduino IR::Remote

This Rubygem provides a wrapper for IR-Learning-Remote that has been built using the Arduino.

Installation

Install Rubygem

% gem install arduino_ir_remote

Dependencies

Hardware Setup

  • Arduino Firmware
  • IR LED
    • Digital PIN 12
  • IR Receiver
    • Digital PIN 3
  • Temperature Sensor (optional)
    • Analog PIN 0
  • Additional Sensors (optional)
    • Analog PIN 1~5

IR Receiver + LED (Minimum setup)

IR Receiver + LED + Temperature Sensor + CdS

Usage

arduino_ir_remote command

% arduino_ir_remote --help
% arduino_ir_remote --list

Read IR Data

% arduino_ir_remote --read tv_on

Write IR Data

% arduino_ir_remote --write tv_on

Rubygem

Connect

require 'arduino_ir_remote'

ir = ArduinoIrRemote.connect   # use default device
ir = ArduinoIrRemote.connect "/dev/tty.usb-devicename"

Read IR DATA

ir.read do |data|
  p data
  ArduinoIrRemote::DATA["tv_on"] = data
  ArduinoIrRemote::DATA.save
end
ir.wait

Write IR DATA

ir.write ArduinoIrRemote::DATA["tv_on"]
ir.wait

Read Sensors

ir.temp_pin = 0  # set temperature sensor pin

loop do
  0.upto(5).each{ |i|
    puts "[analog#{i}] #{ir.analog_read i}"  # read analog input pin 0~5
  }
  puts "temp #{ir.temp_sensor}"  # read temperature sensor
  sleep 1
end

Test

% gem install bundler
% bundle install
% export ARDUINO=/dev/tty.usb-devicename
% bundle exec rake test

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request