本文整理汇总了Python中CHIP_IO.SOFTPWM.set_frequency方法的典型用法代码示例。如果您正苦于以下问题:Python SOFTPWM.set_frequency方法的具体用法?Python SOFTPWM.set_frequency怎么用?Python SOFTPWM.set_frequency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHIP_IO.SOFTPWM
的用法示例。
在下文中一共展示了SOFTPWM.set_frequency方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pwm_frequency_invalid_value_string
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import set_frequency [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()
示例2: test_pwm_frequency_invalid_value_negative
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import set_frequency [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: print
# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import set_frequency [as 别名]
PWMGPIO = "XIO-P7"
#PWMGPIO = "LCD-D4"
COUNT = 150
SLEEPTIME = 0.01
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()