-
Couldn't load subscription status.
- Fork 46
Open
Labels
Milestone
Description
I like the bindata library, and I think that would be fine if RModBus will provides a simple method to work with it:
require 'bindata'
require 'rmodbus'
class Pump < BindData::Records
endian :big
uint16 :state
float :temp
float :pressure
def stopped?
state == 0
end
end
ModBus::TCPClient.connect('localhost') do |cl|
cl.with_slave(1) do |sl|
pump1 = sl.make_image(Pump, :holding, 0...10)
pump1.read
pump1.stopped? #=> false
end
end