Class: Tinkerforge::BrickletSoundPressureLevel

Inherits:
Object
  • Object
show all
Defined in:
lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.rb

Constant Summary collapse

WEIGHTINGS =
[ 'dB(A)', 'dB(B)','dB(C)', 'dB(D)', 'dB(Z)', 'ITU-R 468']

Instance Method Summary collapse

Instance Method Details

#stateObject

Returns the device’s state.



8
9
10
11
12
13
14
15
16
# File 'lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.rb', line 8

def state
  super.merge(
    'configuration'  => conf = get_configuration,
    'weighting'      => WEIGHTINGS[ conf[1] ],
    'sampling_rate'  => 2 ** (3 - conf[0]) * 10,
    'bin_size'       => 2 ** (3 - conf[0]) * 40,
    'sound_pressure' => get_decibel,
  )
end