當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。