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


Python PWM.print_channel方法代码示例

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


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

示例1: granularity

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import print_channel [as 别名]
#set della granularity (è il default durante l'inizializzazione tic di incremento in microsecondi)
PWM.setup(granularity, 0)			#default: pulse_incr_us=10, delay_hw=0

for i in canale_dma:
	PWM.init_channel(i, subcycle_time[i])	#canale DMA con tempo subcycle
#	PWM.setup(granularity, 0)		#default: pulse_incr_us=10, delay_hw=0
	#aggiungo un impulso nel canale DMA all'interno di ogni subcycle per ogni GPIO
	#POSSO ANCHE NON AGGIUNGERE NIENTE :-), VOLENDO.
	PWM.add_channel_pulse(i, gpio_port[i], pulse_start[i], pulse_width[i])
#setup per output su GPIO
for i in gpio_port:
	RPIO.setup(i, RPIO.OUT)

for i in canale_dma:
	PWM.print_channel(i) 
	if PWM.is_channel_initialized(i):
		print ("canale ", i, " inizializzato")
	else:
		print ("canale ", i, " NON inizializzato")
	if PWM.is_setup():
		print ("setup canale ", i, "chiamato")
	else:
		print ("setup canale ", i, " NON chiamato")

try:
    while True:
	# LED per vedere se tutto funziona
	for t in led_time:
		for i in gpio_port:
			RPIO.output(i, RPIO.HIGH)
开发者ID:belcocco,项目名称:raspi,代码行数:32,代码来源:pwm-rpio-0.py

示例2:

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import print_channel [as 别名]
import time
from RPIO import PWM


servo = PWM.Servo()
servo.set_servo(18, 2000)
PWM.print_channel(0)
time.sleep(1)
PWM.print_channel(0)
servo.set_servo(18, 1000)
PWM.print_channel(0)
开发者ID:jakwnd,项目名称:RPi-ISS-Tracking-Pointer,代码行数:13,代码来源:servotest1.py

示例3:

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import print_channel [as 别名]
#	PWM.setup(granularity, 0)		#default: pulse_incr_us=10, delay_hw=0
	#aggiungo un impulso nel canale DMA all'interno di ogni subcycle per ogni GPIO
	#POSSO ANCHE NON AGGIUNGERE NIENTE :-), VOLENDO.
#	PWM.add_channel_pulse(i, gpio_port[i], pulse_start[i], pulse_width[i])

PWM.add_channel_pulse(0, gpio_port[0], pulse_start[0], pulse_width[0])
PWM.add_channel_pulse(1, gpio_port[1], pulse_start[1], pulse_width[1])
PWM.add_channel_pulse(2, gpio_port[2], pulse_start[2], pulse_width[2])
PWM.add_channel_pulse(3, gpio_port[3], pulse_start[3], pulse_width[3])

#setup per output su GPIO
for j in gpio_port:
	RPIO.setup(j, RPIO.OUT)

for k in canale_dma:
	PWM.print_channel(k) 
	if PWM.is_channel_initialized(k):
		print ("canale ", k, " inizializzato")
	else:
		print ("canale ", k, " NON inizializzato")
	if PWM.is_setup():
		print ("setup canale ", k, "chiamato")
	else:
		print ("setup canale ", k, " NON chiamato")

try:
    while True:
	# LED per vedere se tutto funziona
	for t in led_time:
		for p in gpio_port:
			RPIO.output(p, RPIO.HIGH)
开发者ID:belcocco,项目名称:raspi,代码行数:33,代码来源:pwm-rpio-1.py

示例4: changespeed

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import print_channel [as 别名]
import RPIO
from RPIO import PWM as PWM
import time

RPIO.setmode(RPIO.BOARD)

GPIO = 12
CHANNEL = 1

RPIO.setup(GPIO,RPIO.OUT)

# Setup PWM and DMA channel 0
PWM.set_loglevel(PWM.LOG_LEVEL_DEBUG)
PWM.setup()
PWM.init_channel(CHANNEL,20000)
PWM.print_channel(CHANNEL)

RPIO.output(GPIO, False)

def changespeed(current_speed,set_speed,step_size,delay):
  for counter in range (current_speed, set_speed, step_size):
    pwmmotor=int(round(counter*199,-1))
    print(pwmmotor)
    PWM.add_channel_pulse(CHANNEL,GPIO,0,pwmmotor)
    time.sleep(delay)

# Add some pulses to the subcycle
PWM.add_channel_pulse(CHANNEL, GPIO, 0, 0)

changespeed(0,100,1,0.02) # accelerate from 0 to 100% step 1% delay 0.02 S
开发者ID:kosfar,项目名称:rpi,代码行数:32,代码来源:rpioDChw.py

示例5: int

# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import print_channel [as 别名]
		driver2.set_velocity(v2,1)
		pass
	match = re.search(r"\Abrush (-?\d+)", command)
	if(match):
		print "doing: brush ",match.group(1)
		change = int(match.group(1))
		mymotor.setW(change)
		pass
	match = re.search(r"\Aimu", command)
	if(match):
		print "doing: imu "
		pass
	match = re.search(r"\APWM", command)
	if(match):
		print "doing: PWM info "
		PWM.print_channel(0)
		PWM.print_channel(1)
		PWM.print_channel(2)
		PWM.print_channel(3)
		pass
	match = re.search(r"\Aencoder", command)
	if(match):
		print "doing: encoder "
		print "value C1: ",component.get_dist()
		pass
	match = re.search(r"\Aexit", command)
	if(match):
		component_measure.kill()
		run = False #ends the loop
		pass
开发者ID:jcert,项目名称:t_controller,代码行数:32,代码来源:iterative_test.py


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