Class: LegoEv3::LegoSensor

Inherits:
Object
  • Object
show all
Defined in:
lib/sensors/base.rb

Overview

Direct Known Subclasses

ColorSensor, InfraredSensor, TouchSensor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, id, port, driver_name) ⇒ LegoSensor

Returns a new instance of LegoSensor.



6
7
8
9
10
11
# File 'lib/sensors/base.rb', line 6

def initialize(connection, id, port, driver_name)
  @connection = connection
  @id = id
  @port = port
  @driver_name = driver_name
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/sensors/base.rb', line 4

def value
  @value
end

Instance Method Details

#infoObject



13
14
15
16
17
18
19
# File 'lib/sensors/base.rb', line 13

def info
  {
    id: @id,
    port: @port,
    driver_name: @driver_name
  }
end