Class: Pigpio::PWM
- Inherits:
-
Object
- Object
- Pigpio::PWM
- Defined in:
- lib/pigpio/pwm.rb
Instance Method Summary collapse
- #dutycycle ⇒ Object
- #dutycycle=(dutycycle) ⇒ Object
- #frequency ⇒ Object
- #frequency=(frequency) ⇒ Object
-
#initialize(pi, gpio) ⇒ PWM
constructor
A new instance of PWM.
- #range ⇒ Object
- #range=(range) ⇒ Object
- #real_range ⇒ Object
- #servo_pulsewidth ⇒ Object
- #servo_pulsewidth=(pulsewidth) ⇒ Object
- #start(dutycycle) ⇒ Object
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
#dutycycle ⇒ Object
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 |
#frequency ⇒ Object
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 |
#range ⇒ Object
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_range ⇒ Object
28 29 30 |
# File 'lib/pigpio/pwm.rb', line 28 def real_range ret = IF.get_PWM_real_range(@pi, @gpio) end |
#servo_pulsewidth ⇒ Object
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 |