import time import motor_lib motor_lib.io1.wiringPiSetupGpio() dc_motor_1 = motor_lib.pwmMotorDriver(18,17,22) while True: ts_cmd = raw_input('Direction--> ') if ts_cmd == "c": dc_motor_1.rotate(1,10) if ts_cmd == "w": dc_motor_1.rotate(-1,10) if ts_cmd == "s": dc_motor_1.stop()
whattype = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 1, 1, 1, 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2] motor_lib.io1.wiringPiSetupGpio() motor1 = motor_lib.stepperdriver(6400,13,19)#picker_motor (step_per_rotate,pulse,director) motor2 = motor_lib.stepperdriver(6400,5,6)#volacity_motor motor3 = motor_lib.pwmMotorDriver(18,22,17)#string_turning_motor(p_pin,in_b_pin,in_a_pin) motor4 = motor_lib.tstepdriver()#slider_motor ips = commands.getoutput("/sbin/ifconfig | grep -iA2 \"eth0\" | grep -i \"inet\" | grep -iv \"inet6\" | " + "awk {'print $2'} | sed -ne 's/addr\://p'") iplist = ips.split(".") whoami = int(iplist[3]) UDP_IP = iplist[0] + "." + iplist[1] + "." + iplist[2] + "." + str(whoami-100) whoami = whoami - 101 UDP_PORT = 5005 sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.bind(("", UDP_PORT)) soffset = [1910, 1910, 1910, 1910] # S,A,T,B
#------------------------------------------------------------------------ #Code Written by: Albert Lin from Noise Kitchen #Current Project: noisekitchen.tw #------------------------------------------------------------------------ #------------------------------------------------------------------------ import motor_lib import socket import os #------------------------------------------------------------------------ #tp=[] motor_lib.io1.wiringPiSetupGpio() motor1 = motor_lib.stepperdriver(6400,20,16)#picker_motor motor2 = motor_lib.stepperdriver(6400,24,23)#volacity_motor motor3 = motor_lib.pwmMotorDriver(17,27,22)#string_turning_motor motor4 = motor_lib.tstepdriver()#slider_motor UDP_IP = "192.168.12.78" UDP_PORT = 5005 sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.bind(("", UDP_PORT)) iftsh = False iftph = False iftvh = False while False == iftsh or False == iftph or False == iftvh: #while False: data, addr = sock.recvfrom(1024) if data == "tsh":