kuro-rs

DESCRIPTION:

control KURO-RS (www.kuroutoshikou.com/modules/display/?iid=928), PC-OP-RS1 (buffalo.jp/products/catalog/item/p/pc-op-rs1/) and Arduino IR-Remote (www.256byte.com/2010/01/arduino-irremote/)

INSTALL:

  • gem install kuro-rs

SYNOPSIS:

require 'rubygems'
require 'kuro-rs'

# open KURO-RS
kr = KuroRs.open('/dev/tty.usbserial-0012a3b4')

# read
puts kr.read 
## => hex dump (ffffffff0300f0e0018083...)

# write
kr.write 'ffffffff0300f0e0018083'

# close
kr.close

# use block
KuroRs.open('/dev/tty.usbserial-0012a3b4'){|k|
  # sleep 2 ## for Arduino IR-Remote
  k.verbose = true
  puts k.read
  ## => hex dump (ffffffff0300f0e0018083...)
}
  • for Arduino IR-Remote, It needs 2 sec sleep after “KuroRs.open”

TOOLS:

simple command line application.

# read
% kuro-rs /dev/tty.usbserial-0012a3b4

# write
% kuro-rs /dev/tty.usbserial-0012a3b4 ffffffff0300f0e0018083...

http interface

# run server
% kuro-rs-server /dev/tty.usbserial-0012a3b4 -p 8080

# read
% curl 'http://localhost:8080'

# write
% curl -d 'ffffffff0300f0e0018083...' 'http://localhost:8080'

REQUIREMENTS:

  • KURO-RS or PC-OP-RS1

LICENSE:

(The MIT License)

Copyright © 2011 Sho Hashimoto

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.