comedilib/swig/ruby/demo/inp
Frank Mori Hess dfc1ffbdba update to ruby binding from steven jenkins:
Better exception handling. More consistent handling of return values. Updated
documentation.
2004-03-29 01:39:36 +00:00

32 lines
510 B
Ruby
Executable file

#!/usr/bin/env ruby
require 'comedi'
require 'getoptlong'
require 'common'
include Comedi
parse_options
begin
dev = Comedi::open($filename)
rescue
comedi_perror($filename)
exit 1
end
if $verbose
print "measuring device=#{$filename} subdevice=#{$subdevice}"
print " channel=#{$channel} range=#{$range}"
print " analog reference=#{$aref}\n"
end
begin
data = dev.data_read($subdevice, $channel, $range, $aref)
rescue
comedi_perror($filename)
exit 1
end
puts data
exit 0