Arduino IR::Remote ================== 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から操作できるようにした](http://shokai.org/blog/archives/8012) Installation ------------ % gem install arduino_ir_remote Dependencies ------------ ### Requirements - Mac or Linux - Ruby 1.8.7 ~ 2.0.0 - [Arduino](http://arduino.cc) Micro or Leonard - [38KHz IR Receiver](http://akizukidenshi.com/catalog/g/gI-00614/) - IR LED - [Temperature Sensor LM35DZ](http://akizukidenshi.com/catalog/g/gI-00116/) ### Setup Arduino - Firmware - https://github.com/shokai/arduino_ir_remote/blob/master/arduino/arduino.ino - IR LED - Digital PIN 12 - IR Receiver - Digital PIN 3 - Temperature Sensor - Analog PIN 0 arduino_ir_remote command ------------------------- % arduino_ir_remote --help % arduino_ir_remote --list read IR % arduino_ir_remote --read tv_on write IR % arduino_ir_remote --write tv_on Gem Usage --------- ### Connect ```ruby require 'arduino_ir_remote' ir = ArduinoIrRemote.connect # use default device ir = ArduinoIrRemote.connect "/dev/tty.usb-devicename" ``` ### Read IR DATA ```ruby ir.read do |data| p data end ir.wait ``` ### Write IR DATA ```ruby ir.write data ir.wait ``` ### Read Sensors ```ruby 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