Class: Pigpio::PWM

Inherits:
Object
  • Object
show all
Defined in:
lib/pigpio/pwm.rb

Instance Method Summary collapse

Constructor Details

#initialize(pi, gpio) ⇒ PWM

Returns a new instance of PWM.



3
4
5
6
# File 'lib/pigpio/pwm.rb', line 3

def initialize(pi, gpio)
  @pi = pi
  @gpio = gpio
end

Instance Method Details

#dutycycleObject



16
17
18
# File 'lib/pigpio/pwm.rb', line 16

def dutycycle
  ret = IF.get_PWM_dutycycle(@pi, @gpio)
end

#dutycycle=(dutycycle) ⇒ Object



12
13
14
# File 'lib/pigpio/pwm.rb', line 12

def dutycycle=(dutycycle)
  ret = IF.set_PWM_dutycycle(@pi, @gpio, dutycycle)
end

#frequencyObject



36
37
38
# File 'lib/pigpio/pwm.rb', line 36

def frequency
  ret = IF.get_PWM_frequency(@pi, @gpio)
end

#frequency=(frequency) ⇒ Object



32
33
34
# File 'lib/pigpio/pwm.rb', line 32

def frequency=(frequency)
  ret = IF.set_PWM_frequency(@pi, @gpio, frequency)
end

#rangeObject



24
25
26
# File 'lib/pigpio/pwm.rb', line 24

def range
  ret = IF.get_PWM_range(@pi, @gpio)
end

#range=(range) ⇒ Object



20
21
22
# File 'lib/pigpio/pwm.rb', line 20

def range=(range)
  ret = IF.set_PWM_range(@pi, @gpio, range)
end

#real_rangeObject



28
29
30
# File 'lib/pigpio/pwm.rb', line 28

def real_range
  ret = IF.get_PWM_real_range(@pi, @gpio)
end

#servo_pulsewidthObject



44
45
46
# File 'lib/pigpio/pwm.rb', line 44

def servo_pulsewidth
  ret = IF.get_servo_pulsewidth(@pi, @gpio)
end

#servo_pulsewidth=(pulsewidth) ⇒ Object



40
41
42
# File 'lib/pigpio/pwm.rb', line 40

def servo_pulsewidth=(pulsewidth)
  ret = IF.set_servo_pulsewidth(@pi, @gpio, pulsewidth)
end

#start(dutycycle) ⇒ Object



8
9
10
# File 'lib/pigpio/pwm.rb', line 8

def start(dutycycle)
  ret = IF.set_PWM_dutycycle(@pi, @gpio, dutycycle)
end