当前位置: 首页>>代码示例>>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;未经允许,请勿转载。