Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(6)  |  Derive(0)  |  Import(0)
Change the duty cycle
dutycycle - between 0.0 and 100.0

src/a/d/Adafruit_BBIO-0.0.19/test/test_pwm_setup.py   Adafruit_BBIO(Download)
        assert int(period) == 500000
 
        PWM.set_duty_cycle("P9_14", 100)
        duty = open(pwm_test + '/duty').read()
        period = open(pwm_test + '/period').read()
    def test_pwm_duty_cycle_non_setup_key(self):
        with pytest.raises(RuntimeError):
            PWM.set_duty_cycle("P9_14", 100)
            PWM.cleanup()    
 
    def test_pwm_duty_cycle_invalid_key(self):
        with pytest.raises(ValueError):
            PWM.set_duty_cycle("P9_15", 100)
    def test_pwm_duty_cycle_invalid_value_high(self):
        PWM.start("P9_14", 0)
        with pytest.raises(ValueError):
            PWM.set_duty_cycle("P9_14", 101)
            PWM.cleanup()
 
    def test_pwm_duty_cycle_invalid_value_negative(self):
        PWM.start("P9_14", 0)
        with pytest.raises(ValueError):
            PWM.set_duty_cycle("P9_14", -1)