This Rubygem provides a wrapper for IR-Learning-Remote that has been built using the Arduino.
- https://github.com/shokai/arduino_ir_remote
- Read/Write IR Remote on CUI and WebUI
- Arduinoで赤外線リモコン作ってWebから操作できるようにした
% gem install arduino_ir_remote
- Mac or Linux
- Ruby 1.8.7 ~ 2.0.0
- Arduino, testing on Micro or Leonard
- 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
% 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
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
% gem install bundler
% bundle install
% export ARDUINO=/dev/tty.usb-devicename
% bundle exec rake test
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request