Sha256: 0308e94565277851118e5730d6ece0be3d131fdd82e25435771628e68d904ac3
Contents?: true
Size: 685 Bytes
Versions: 1
Compression:
Stored size: 685 Bytes
Contents
module Minilab class AnalogIo #@private 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.1-x86-mingw32 | lib/minilab/analog_io.rb |