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


Python Motor.rpm方法代码示例

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


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

示例1: handle_read

# 需要导入模块: from motor import Motor [as 别名]
# 或者: from motor.Motor import rpm [as 别名]
    def handle_read(self):
       
        data0 = self.recv(160);
        if data0:            
            data = ConstBitStream(bytes=data0, length=160)
            # print "All: %s" % data.bin
 
            msize = data.read('intle:16')
            mtype = data.read('intle:16')
            mtime = data.read('intle:64')
 
            # RA: 
            ant_pos = data.bitpos
            ra = data.read('hex:32')
            data.bitpos = ant_pos
            ra_uint = data.read('uintle:32')
 
            # DEC:
            ant_pos = data.bitpos
            dec = data.read('hex:32')
            data.bitpos = ant_pos
            dec_int = data.read('intle:32')
             
            logging.debug("Size: %d, Type: %d, Time: %d, RA: %d (%s), DEC: %d (%s)" % (msize, mtype, mtime, ra_uint, ra, dec_int, dec))
                       
            (ra, dec, time) = coords.int_2_rads(ra_uint, dec_int, mtime)

            x = transformar_coordenadas(dec, ra)
            az,alt = x.get_azi_alt()

            #instancia o motor de azimute nos pinos 12, 16, 20 e 21 do RPi
            motor_az = Motor([31,33,35,37])
            motor_az.rpm = 5
            motor_az.mode = 2
            motor_az.move_to(az-self.az_anterior)
            self.az_anterior = az

            #instancia o motor de azimute nos pinos 32, 36, 38 e 40 do RPi
            motor_alt = Motor([32,36,38,40])
            motor_alt.rpm = 5
            motor_alt.mode = 2
            motor_alt.move_to(alt-self.alt_anterior)
            self.alt_anterior = alt

            logging.debug("Azimute: %d, Altitude: %d" % (az,alt))
            
            # envia as cordenadas para o Stellarium
            self.act_pos(ra, dec)
开发者ID:israelps,项目名称:telescopioRpi,代码行数:50,代码来源:servidor.py

示例2: str

# 需要导入模块: from motor import Motor [as 别名]
# 或者: from motor.Motor import rpm [as 别名]
import RPi.GPIO as GPIO
import picamera
from time import sleep
from motor import Motor

GPIO.setmode(GPIO.BCM)

PINS_ON_ULN = [17,18,22,23]
ROTATION_ANGLE = 225
PICTURE_EACH_HOW_MUCH_DEGREES = 1
MILLISECONDS_OF_WORK = 4 * 60 * 60
STEPS = ROTATION_ANGLE / PICTURE_EACH_HOW_MUCH_DEGREES
SLEEP_PER_STEP = MILLISECONDS_OF_WORK / STEPS
SLEEP_PER_PICTURE = 10000

print "Sleep per step: " + str(SLEEP_PER_STEP)
motor = Motor(PINS_ON_ULN)
motor.rpm = 1
with picamera.PiCamera() as camera:
    degree = 0.0
    while degree < ROTATION_ANGLE:
        filename = 'deg'+str(degree)+'.jpg'
        print "Capturing: " + filename
        camera.capture(filename)
	degree += PICTURE_EACH_HOW_MUCH_DEGREES 
	print "move to "+str(degree)
        motor.move_to(degree)
	sleep(SLEEP_PER_STEP)
开发者ID:jonatas,项目名称:motolapse,代码行数:30,代码来源:run.py


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