本文整理汇总了Python中RPIO.PWM.cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python PWM.cleanup方法的具体用法?Python PWM.cleanup怎么用?Python PWM.cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RPIO.PWM
的用法示例。
在下文中一共展示了PWM.cleanup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __exit__
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def __exit__(self, eType, eValue, eTrace):
""" Clean up routine for context manager (with-statement).
Takes care of closing DMA channel - failure to do this breaks OS and a reboot will be needed."""
log.info("Destroying " + str(self))
self.set([0, 0, 0])
sleep(PWM_PRD / 1e6) # wait a period to ensure set() has been actioned
PWM.clear_channel(PWM_DMA)
PWM.clear_channel(PWM_DMA1)
PWM.cleanup()
return False
示例2: main
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def main():
servo = PWM.Servo()
time.sleep(0.2)
init(servo)
move(servo, 0)
move(servo, 180)
move(servo, 0)
PWM.cleanup()
示例3: pwm_example2
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def pwm_example2():
from RPIO import PWM
# Setup PWM and DMA channel 0
PWM.setup()
PWM.init_channel(0)
# Add some pulses to the subcycle
PWM.add_channel_pulse(0, 17, 0, 50)
PWM.add_channel_pulse(0, 17, 100, 50)
# Stop PWM for specific GPIO on channel 0
PWM.clear_channel_gpio(0, 17)
# Shutdown all PWM and DMA activity
PWM.cleanup()
示例4: __init__
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def __init__(self):
PWM.cleanup()
PWM.setup(1)
PWM.init_channel(1, 5000)
PWM.init_channel(2, 5000)
PWM.init_channel(3, 5000)
self.r = 0
self.g = 0
self.b = 0
self.dimFactor = 1.
self.fadeTimer = None
self.fadeCallback = None
self.fadeStartTime = datetime.now()
self.fadeSeconds = None
示例5: cleanup
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def cleanup():
PWM.cleanup()
示例6: end
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def end():
PWM.cleanup()
示例7: eStop
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def eStop(self):
PWM.cleanup();
RPIO.output(self.APHASE_Pin,RPIO.LOW);
RPIO.output(self.BPHASE_Pin,RPIO.LOW);
示例8: clean_up
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def clean_up(): # Clean up and exit script
set_led(0,0,0)
GPIO.cleanup()
PWM.cleanup()
time.sleep(0.5)
sys.exit()
示例9: cleanup
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def cleanup(self):
#self.ser.close()
PWM.clear_channel_gpio(1, 17)
PWM.clear_channel_gpio(2, 27)
PWM.clear_channel_gpio(3, 22)
PWM.cleanup()
示例10: end
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def end(self):
"""Cleanup after usage."""
PWM.cleanup()
示例11: deInit
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def deInit(self):
self.servo.stop_servo(self.gpioPin)
PWM.cleanup()
示例12: __del__
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def __del__(self):
PWM.cleanup()
示例13: handle
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
#.........这里部分代码省略.........
autopilot.stop()
#time.sleep(.3)
autopilot.strafeL()
movDirection = 4
print('Start Moving left')
# Moving left following front wall
if(sensor1 == 1 and sensor4 == 0 and sensor2 == 0 and sensor3 == 0 and movDirection == 4):
#print("Moving left following front wall")
autopilot.stop()
#time.sleep(.3)
autopilot.strafeL()
autopilot.backward()
#movDirection = 4
print('Moving left')
if(sensor1 == 0 and sensor4 == 0 and sensor2 == 0 and sensor3 == 0 and movDirection == 4):
autopilot.stop()
#time.sleep(.3)
autopilot.strafeL()
autopilot.forward()
#movDirection = 4
print('Moving left-ADJ')
# End following front wall
# Lost front wall
if(sensor1 == 0 and sensor2 == 0 and sensor3 == 0 and sensor4 == 0 and movDirection == 4):
#print("Lost front wall")
autopilot.stop()
time.sleep(.3)
audopilot.strafeL()
time.sleep(.3)
autopilot.stop()
time.sleep(.5)
autopilot.forward()
time.sleep(.5)
autopilot.stop()
time.sleep(.5)
movDirection = 2
while (sensor3 == 0):
autopilot.strafeR()
time.sleep(1)
autopilot.stop()
print('Wall vanished')
ser.flush()
# Found back left corner
if(sensor1 == 1 and sensor2 == 0 and sensor3 == 0 and sensor4 == 1 and movDirection == 4):
print("Found back left corner")
autopilot.stop()
time.sleep(1)
autopilot.turnR()
time.sleep(1.5)
autopilot.stop()
time.sleep(1)
search = 1
navigating = 0
ser.flush()
# No direction to fly
if(sensor1 == 1 and sensor2 == 1 and sensor3 == 1 and sensor4 == 1):
#print("No direction to fly")
autopilot.land()
time.sleep(5)
flying = 0
print('Can\'t fly')
# Emergency kill command
if(buf == "kill"):
autopilot.throttleCut()
#time.sleep(10)
#autopilot.landed()
flying = 0
#print('Killing operation')
if(isKill):
#autopilot.throttleCut()
autopilot.stop()
autopilot.land()
time.sleep(10)
flying = 0
return
#print('Killed manually')
# Variable for if ball is seen
seen = 0
# Start searching for ball -- Needs implemented
#while(search == 1 and buf != 'stop'):
# Capture image and look for ball
# Close the socket if ctrl+c key combination is used
except KeyboardInterrupt:
clientsocket.close()
# Close the socket in all other exceptions
except:
print('Error occured, closing socket')
PWM.cleanup()
clientsocket.close()
示例14: destroy
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def destroy():
webiopi.debug("Script with macros - Destroy")
# Shutdown all PWM and DMA activity
PWM.cleanup()
示例15: cleanup
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def cleanup(self):
if self.__backlight:
PWM.clear_channel_gpio(0, self.__backlight)
PWM.cleanup()
GPIO.cleanup()