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


Python PWM.cleanup方法代码示例

本文整理汇总了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
开发者ID:eGuard,项目名称:HECH,代码行数:12,代码来源:RgbLed.py

示例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()
开发者ID:anuwish,项目名称:sesame-melody,代码行数:13,代码来源:servo-hpwm-test.py

示例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()
开发者ID:CloseCall,项目名称:quadcopter,代码行数:18,代码来源:quadcopter.py

示例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
开发者ID:fastfieros,项目名称:sunrise,代码行数:19,代码来源:sunrise.py

示例5: cleanup

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def cleanup():
 	PWM.cleanup()
开发者ID:JCcalonge6,项目名称:Spring2015EmbeddedLinux,代码行数:4,代码来源:piCam4.py

示例6: end

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
def end():
    PWM.cleanup()
开发者ID:mattvenn,项目名称:raspi-buggy,代码行数:4,代码来源:buggy.py

示例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);
开发者ID:haomen,项目名称:rbot,代码行数:6,代码来源:motor.py

示例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()
开发者ID:Agilic-Development,项目名称:tiddly-script,代码行数:8,代码来源:tiddly_bot_code_v7.py

示例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()
开发者ID:fastfieros,项目名称:sunrise,代码行数:8,代码来源:sunrise.py

示例10: end

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
 def end(self):
     """Cleanup after usage."""
     PWM.cleanup()
开发者ID:bootsa,项目名称:pibot,代码行数:5,代码来源:pibot.py

示例11: deInit

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
	def deInit(self):
		self.servo.stop_servo(self.gpioPin)
		PWM.cleanup()
开发者ID:portjm1221,项目名称:NIHA-Home-Automation-rPi,代码行数:5,代码来源:ControlServo.py

示例12: __del__

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import cleanup [as 别名]
 def __del__(self):
     PWM.cleanup()
开发者ID:albertskog,项目名称:Wakeup-Light,代码行数:4,代码来源:pwm.py

示例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()
开发者ID:campbeb6,项目名称:RedhawkQuad,代码行数:104,代码来源:takeoff.py

示例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()
开发者ID:rasplay,项目名称:clickpirc,代码行数:7,代码来源:rc_script_pwm.py

示例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()
开发者ID:DJSymBiotiX,项目名称:RPiLiquidCrystal,代码行数:7,代码来源:LCD.py


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