当前位置: 首页>>代码示例>>Python>>正文


Python SOFTPWM.start方法代码示例

本文整理汇总了Python中CHIP_IO.SOFTPWM.start方法的典型用法代码示例。如果您正苦于以下问题:Python SOFTPWM.start方法的具体用法?Python SOFTPWM.start怎么用?Python SOFTPWM.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CHIP_IO.SOFTPWM的用法示例。


在下文中一共展示了SOFTPWM.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_start_pwm

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [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()
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:10,代码来源:test_softpwm_setup.py

示例2: __init__

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def __init__(self, pin, freq=500, duty_min=49.0, duty_max=90.0, stop_on_zero=False):
     self.pin = pin
     self.freq = freq
     self.duty_min = duty_min
     self.duty_max = duty_max
     self.stop_on_zero = stop_on_zero
     sleep(0.1)
     PWM.start(pin, 0, 500)
开发者ID:artizirk,项目名称:sumochip,代码行数:10,代码来源:sumorobot.py

示例3: test_pwm_duty_cycle_invalid_value_negative

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [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()
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:7,代码来源:test_softpwm_setup.py

示例4: test_pwm_start_invalid_polarity_type

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_invalid_polarity_type(self):
     with pytest.raises(TypeError):
         PWM.start("XIO-P7", 0, 100, "1")
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例5: test_pwm_start_invalid_positive_polarity

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_invalid_positive_polarity(self):
     with pytest.raises(ValueError):
         PWM.start("XIO-P7", 0, 100, 2)
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例6: test_pwm_start_negative_polarity

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_negative_polarity(self):
     with pytest.raises(ValueError):
         PWM.start("XIO-P7", 0, 100, -1)
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例7: test_pwm_start_invalid_frequency_string

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_invalid_frequency_string(self):
     with pytest.raises(TypeError):
         PWM.start("XIO-P7", 0, "1")
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例8: test_pwm_start_invalid_frequency_negative

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_invalid_frequency_negative(self):
     with pytest.raises(ValueError):
         PWM.start("XIO-P7", 0, -1)
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例9: test_start_pwm

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [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()
开发者ID:cornbreadheadman,项目名称:CHIP_IO,代码行数:8,代码来源:test_softpwm_setup.py

示例10: test_pwm_start_invalid_duty_cycle_high

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_invalid_duty_cycle_high(self):
     with pytest.raises(ValueError):
         PWM.start("XIO-P7", 101)
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例11: test_pwm_start_valid_duty_cycle_max

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_valid_duty_cycle_max(self):
     # testing an exception isn't thrown
     PWM.start("XIO-P7", 100)
     PWM.cleanup()
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:6,代码来源:test_softpwm_setup.py

示例12: test_pwm_start_invalid_duty_cycle_negative

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_invalid_duty_cycle_negative(self):
     with pytest.raises(ValueError):
         PWM.start("XIO-P7", -1)
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例13: test_pwm_start_invalid_pwm_key

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [as 别名]
 def test_pwm_start_invalid_pwm_key(self):
     with pytest.raises(ValueError):
         PWM.start("P8_25", -1)
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:5,代码来源:test_softpwm_setup.py

示例14: test_pwm_frequency_invalid_value_string

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [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()
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:7,代码来源:test_softpwm_setup.py

示例15: test_pwm_duty_cycle_invalid_value_string

# 需要导入模块: from CHIP_IO import SOFTPWM [as 别名]
# 或者: from CHIP_IO.SOFTPWM import start [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()
开发者ID:aninternetof,项目名称:CHIP_IO,代码行数:7,代码来源:test_softpwm_setup.py


注:本文中的CHIP_IO.SOFTPWM.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。