class RPiVibratingMotor

Public Class Methods

new(gpio_pin) click to toggle source
Calls superclass method
# File lib/rpi_vibratingmotor.rb, line 10
def initialize(gpio_pin)
  super(gpio_pin)    
end

Public Instance Methods

action_required() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 14
def action_required()
  @t = Thread.new{ pin.oscillate 0.2 }
end
incoming_call() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 26
def incoming_call()
  @t = Thread.new{ loop { pin.oscillate 0.5, duration: 2; sleep 3} }
end
incoming_email_message() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 22
def incoming_email_message()
  pin.oscillate 0.3, duration: 0.7
end
incoming_instant_message() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 18
def incoming_instant_message()
  pin.oscillate 0.1, duration: 0.3
end
quiet_action_required() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 30
def quiet_action_required()

  @t = Thread.new do
    loop {pin.oscillate 0.01, duration: 0.2; sleep 0.4}
  end

end
quiet_confirmation() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 38
def quiet_confirmation()
  pin.oscillate 0.05, duration: 0.2
end
quiet_incoming_call() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 42
def quiet_incoming_call()

  @t = Thread.new do
    loop do
      2. times { pin.oscillate 0.01, duration: 0.3; sleep 0.5}; sleep 1.5
    end
  end

end
quiet_incoming_message() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 52
def quiet_incoming_message()
  pin.oscillate 0.01, duration: 0.5
end
stop() click to toggle source
# File lib/rpi_vibratingmotor.rb, line 56
def stop()
  pin.stop
  @t.exit
end