Sha256: 9760204d3e18ceaa6c59cd374b56cf9d6daba111cff6caec07e95973882aa020
Contents?: true
Size: 684 Bytes
Versions: 1
Compression:
Stored size: 684 Bytes
Contents
module Minilab class AnalogIo #:nodoc: constructor :minilab_wrapper def read_analog(channel) check_channel_range(channel, 0, 7) @minilab_wrapper.read_analog(channel) end def write_analog(channel, volts) check_channel_range(channel, 0, 1) unless (0.0 .. 5.0) === volts raise "#{volts} volts is out of range for this device; Only voltage between 0.0 and 5.0 is supported." end @minilab_wrapper.write_analog(channel, volts) end private def check_channel_range(channel, low, high) raise "Channel #{channel} is out of range." unless (low..high) === channel end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
minilab-2.0.0-x86-mingw32 | lib/minilab/analog_io.rb |