Class: Tamashii::Agent::Device::Buzzer::PwmBuzzer

Inherits:
Base show all
Defined in:
lib/tamashii/agent/device/buzzer/pwm_buzzer.rb

Constant Summary collapse

SHORT_PLAY_TIME =
0.2
LONG_PLAY_TIME =
0.5
REPEAT_INTERVAL =
0.1
LOW_FREQ =
0.7

Instance Method Summary collapse

Methods included from Common::Loggable

#display_name, #logger, #progname

Methods inherited from DeviceBase

#fetch_option, #fetch_option!, #unexport_pin

Constructor Details

#initialize(*args) ⇒ PwmBuzzer

Returns a new instance of PwmBuzzer.



15
16
17
18
# File 'lib/tamashii/agent/device/buzzer/pwm_buzzer.rb', line 15

def initialize(*args)
  super
  setup_pwm
end

Instance Method Details

#default_pinObject



36
37
38
# File 'lib/tamashii/agent/device/buzzer/pwm_buzzer.rb', line 36

def default_pin
  19
end

#play_errorObject



32
33
34
# File 'lib/tamashii/agent/device/buzzer/pwm_buzzer.rb', line 32

def play_error
  play_repeat_long(3)
end

#play_noObject



28
29
30
# File 'lib/tamashii/agent/device/buzzer/pwm_buzzer.rb', line 28

def play_no
  play_repeat_short(3)
end

#play_okObject



24
25
26
# File 'lib/tamashii/agent/device/buzzer/pwm_buzzer.rb', line 24

def play_ok
  play_repeat_short(1)
end

#shutdownObject



20
21
22
# File 'lib/tamashii/agent/device/buzzer/pwm_buzzer.rb', line 20

def shutdown
  stop
end