Skip to content

Commit

Permalink
Servo Buzzer and IRTransmitter should start in :output_pwm
Browse files Browse the repository at this point in the history
  • Loading branch information
vickash committed Aug 25, 2024
1 parent 6a0cdd1 commit a6645ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/denko/motor/servo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Servo
include Behaviors::Threaded

def after_initialize(options={})
options[:mode] = :output_pwm
super(options)
@min = options[:min] || 544
@max = options[:max] || 2400
Expand Down
5 changes: 5 additions & 0 deletions lib/denko/pulse_io/buzzer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module Denko
module PulseIO
class Buzzer < PWMOutput
def initialize_pins(options={})
options[:mode] = :output_pwm
super(options)
end

def after_initialize(options={})
low
end
Expand Down
5 changes: 5 additions & 0 deletions lib/denko/pulse_io/ir_transmitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ module PulseIO
class IRTransmitter
include Behaviors::OutputPin

def initialize_pins(options={})
options[:mode] = :output_pwm
super(options)
end

def emit(pulses=[], frequency: 38)
if pulses.length > 256 || pulses.length < 1
raise ArgumentError, 'wrong number of IR pulses (expected 1 to 256)'
Expand Down

0 comments on commit a6645ee

Please sign in to comment.