當前位置: 首頁>>代碼示例>>Python>>正文


Python Motor.setup方法代碼示例

本文整理匯總了Python中motor.Motor.setup方法的典型用法代碼示例。如果您正苦於以下問題:Python Motor.setup方法的具體用法?Python Motor.setup怎麽用?Python Motor.setup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在motor.Motor的用法示例。


在下文中一共展示了Motor.setup方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from motor import Motor [as 別名]
# 或者: from motor.Motor import setup [as 別名]
def main():
    log_file = "main_log.log"
    create_timed_rotating_log("log/" + log_file)
    logger = logging.getLogger("BasicLogger")
    logger.info("----- Starting Logging Session -----")
    config = configparser.ConfigParser()
    config.read('config.ini')

    # How to use the config values. REMOVE when done with setup of this!
    print(config.sections())
    print('scale of this whole thing from config file is: ' + config['grid']['scale'])
    # To get the values as integers:
    i = int(config['grid']['max_position_z'])
    print(i+2)

    # subprocess.call("../gcodepull.sh", shell=True)

    #opens the file named in the varibles file
    length = range(FileOperator.OpenFile()- 3)
    Motor.setup()
    start = 2
    for row in length:
            # for the appropiated length each row is worked through 
            # and the needet steps are sent to the stepper motors
            next_row = row + start
            delta_step = FileOperator.NextMove(next_row)
            corrected_coords = FileOperator.MoveCorrect(delta_step)
            Motor.move(corrected_coords)
            print('finished')
    GPIO.cleanup()
開發者ID:LukasOtis,項目名稱:steppingMotor,代碼行數:32,代碼來源:pathfinder.py

示例2: init

# 需要導入模塊: from motor import Motor [as 別名]
# 或者: from motor.Motor import setup [as 別名]
def init():
    # set up the wifi interface
    global wifi_interface
    wifi_interface = WifiInterface(115200, "CLIENT", "192.168.2.1", 8888)
    wifi_interface.init_interface()

    # set up the motors
    global motor_fr
    motor_fr = Motor(17)
    motor_fr.setup()
    global motor_fl
    motor_fl = Motor(18)
    motor_fl.setup()
    global motor_br
    motor_br = Motor(19)
    motor_br.setup()
    global motor_bl
    motor_bl = Motor(20)
    motor_bl.setup()
開發者ID:cstettner,項目名稱:picopter,代碼行數:21,代碼來源:picopter.py

示例3: Led

# 需要導入模塊: from motor import Motor [as 別名]
# 或者: from motor.Motor import setup [as 別名]
# Power
ON = True
OFF = False

# Entry
ADDRESS = 0
USERNAME = 1

if __name__ == '__main__':
    # Components
	ld = Led(red_pin=4, green_pin=17)
	ld.setup()
    
    motor = Motor(step_pin=23, dir_pin=24, power_pin=25)
	motor.setup()

    encoder = Encoder(clk_pin=22, dir_pin=27)
    encoder.setup()

	db = Database(host, "philosoraptor", "explosion", "doorman")
	db.setup()

	rfid = Rfid()
	rfid.setup()

    # Main Loop
	while True:
		ld.setstate(ld.BOTH)
		addr = rfid.getaddr()
		if addr:
開發者ID:explosionraptors,項目名稱:CSEE-4920,代碼行數:32,代碼來源:main.py

示例4: print

# 需要導入模塊: from motor import Motor [as 別名]
# 或者: from motor.Motor import setup [as 別名]
print('        ydir: ' + str(ydir) + ' ystep:  ' + str(ystep))
print('        zdir: ' + str(zdir) + ' zstep:  ' + str(zstep))
print('        enable pin: ' + str(enable_pin))
print('        sleep time: ' + str(sleep_time))
print('        ---------------------')
print('        x_mil: ' + str(x_mil))
print('        y_mil: ' + str(y_mil))
print('        z_mil: ' + str(z_mil))

inputok = input('-      Looks good? Keep going? (y/n)  ')
if inputok != 'y':
    sys.exit('( ! )     Okay. Stopping ...')
    Motor.cleanup(motor)

motor = Motor(xdir, xstep, ydir, ystep, zdir, zstep, enable_pin, sleep_time)
Motor.setup(motor)
#import code; code.interact(local=dict(globals(), **locals()))
operator = FileOperator(motor, x_mil, y_mil, z_mil)

print('')
print('( 3 )  Choosing GCODE File')
files = os.listdir('./gcodefiles/')
filnum = -1
for file in files:
    filnum += 1
    print('      ' + str(filnum) + ' : ' + file)

inputfile = input('-      Choose file by entering (0...' + str(filnum) + '): ')
filename = files[int(inputfile)]
filepath = './gcodefiles/' + filename
開發者ID:LukasOtis,項目名稱:steppingMotor,代碼行數:32,代碼來源:run.py


注:本文中的motor.Motor.setup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。