module MatrixCreator::Uv

Module: UV

Communicate with the UV driver

Constants

BASE_PORT

Base port to send data to UV driver

UV_CONFIG

Configuration values for the UV driver

Public Class Methods

detect(options = {}, &block) click to toggle source

Detects and returns information from the UV driver

@param options [Hash] of keys and values that can contain speed, max_resp and/or max_secs @return [Array] elements detected in JSON format

@example Detect 3 values for the UV driver

MatrixCreator::Uv.detect(max_resp: 3)

@example Detect values for the UV driver for 30 seconds

MatrixCreator::Uv.detect(max_secs: 30)

@example Detect values for the UV driver with a speed of 0.5 seconds per response

MatrixCreator::Uv.detect(max_secs: 30, speed: 0.5)

@example Detect values for the UV driver for 15 seconds and process data when received

MatrixCreator::Uv.detect(max_resp: 10){ |data|
  // Do something with the data
}
# File lib/matrix_creator/uv.rb, line 35
def self.detect(options = {}, &block)
  MatrixCreator::DriverBase.detect(BASE_PORT, MatrixMalos::UV, options, block)
end
detect_once() click to toggle source

Detects one response from the UV driver and returns its value

@return [Hash] object with the UV response values

# File lib/matrix_creator/uv.rb, line 44
def self.detect_once
  detect(max_resp: 1).first
end