本文整理汇总了Python中CHIP_IO.SOFTPWM.cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python SOFTPWM.cleanup方法的具体用法?Python SOFTPWM.cleanup怎么用?Python SOFTPWM.cleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHIP_IO.SOFTPWM
的用法示例。
在下文中一共展示了SOFTPWM.cleanup方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_start_pwm
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_start_pwm(self):
PWM.start("XIO-P7", 50, 10)
base = GPIO.get_gpio_base() + 7
gfile = '/sys/class/gpio/gpio%d' % base
assert os.path.exists(gfile)
direction = open(gfile + '/direction').read()
assert(direction == 'out\n')
PWM.cleanup()
示例2: test_pwm_frequency_invalid_value_negative
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_pwm_frequency_invalid_value_negative(self):
PWM.start("XIO-P7", 0)
with pytest.raises(ValueError):
PWM.set_frequency("XIO-P7", -1)
PWM.cleanup()
示例3: test_pwm_duty_cycle_invalid_value_string
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_pwm_duty_cycle_invalid_value_string(self):
PWM.start("XIO-P7", 0)
with pytest.raises(TypeError):
PWM.set_duty_cycle("XIO-P7", "a")
PWM.cleanup()
示例4: test_pwm_duty_cycle_invalid_value_negative
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_pwm_duty_cycle_invalid_value_negative(self):
PWM.start("XIO-P7", 0)
with pytest.raises(ValueError):
PWM.set_duty_cycle("XIO-P7", -1)
PWM.cleanup()
示例5: test_pwm_duty_cycle_invalid_key
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_pwm_duty_cycle_invalid_key(self):
with pytest.raises(ValueError):
PWM.set_duty_cycle("P9_15", 100)
PWM.cleanup()
示例6: teardown_module
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def teardown_module(module):
PWM.cleanup()
示例7: test_pwm_duty_cycle_non_setup_key
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_pwm_duty_cycle_non_setup_key(self):
with pytest.raises(RuntimeError):
PWM.set_duty_cycle("XIO-P7", 100)
PWM.cleanup()
示例8: test_pwm_start_valid_duty_cycle_max
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_pwm_start_valid_duty_cycle_max(self):
# testing an exception isn't thrown
PWM.start("XIO-P7", 100)
PWM.cleanup()
示例9: test_pwm_frequency_invalid_value_string
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_pwm_frequency_invalid_value_string(self):
PWM.start("XIO-P7", 0)
with pytest.raises(TypeError):
PWM.set_frequency("XIO-P7", "11")
PWM.cleanup()
示例10: setup_method
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def setup_method(self, test_method):
PWM.cleanup()
示例11: test_start_pwm
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
def test_start_pwm(self):
PWM.start("XIO-P7", 50, 10)
assert os.path.exists('/sys/class/gpio/gpio415')
direction = open('/sys/class/gpio/gpio415/direction').read()
assert direction == 'out\n'
PWM.cleanup()
示例12: print
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import cleanup [as 别名]
time.sleep(1)
# SETUP PWM
try:
print("PWM START")
#PWM.toggle_debug()
PWM.start(PWMGPIO, 50, 45, 1)
# UNCOMMENT FOR CRASH
print("PWM SET FREQUENCY")
PWM.set_frequency(PWMGPIO, 10)
# UNCOMMENT FOR CRASH
print("PWM SET DUTY CYCLE")
PWM.set_duty_cycle(PWMGPIO, 25)
#time.sleep(COUNT*SLEEPTIME + 1)
raw_input("PRESS ENTER WHEN DONE")
except:
raise
finally:
# CLEANUP
print("CLEANUP")
PWM.stop(PWMGPIO)
PWM.cleanup()
#OM.unload("PWM0")
#GPIO.cleanup()