예제 #1
0
import motor_lib
import time
#------------------------------------------------------------------------


motor_lib.io1.wiringPiSetupGpio()
motor1 = motor_lib.stepperdriver(6400,13,19)#picker_motor

motor1.picker_action(100)

#motor_lib.io1.delayMicroseconds(800000)
#motor1.picker_stopsound()
#motor_lib.io1.delayMicroseconds(800000)
time.sleep(1)
motor1.picker_action(100)
#motor_lib.io1.delayMicroseconds(800000)
#motor1.picker_stopsound()
#motor_lib.io1.delayMicroseconds(800000)

#motor1.picker_action(300)
#motor_lib.io1.delayMicroseconds(800000)
#motor1.picker_stopsound()
#motor_lib.io1.delayMicroseconds(800000)

#motor1.picker_action(300)
#motor_lib.io1.delayMicroseconds(800000)
#motor1.picker_stopsound()
#motor_lib.io1.delayMicroseconds(800000)
예제 #2
0
import motor_lib

# ------------------------------------------------------------------------


motor_lib.io1.wiringPiSetupGpio()
motor1 = motor_lib.stepperdriver(6400, 13, 19)  # picker_motor
motor2 = motor_lib.stepperdriver(6400, 5, 6)  # volacity_motor

motor2.rotate(1, 8, 120, 0, 0)
motor1.rotate(1, 0.1, 120, 0, 0)
prs = motor1.gh(-1, 120, 0.975, 26)
예제 #3
0
#------------------------------------------------------------------------
#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":
#==Mapping type of string  S==A==T==B  <===>  0==1==2==3  

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))
예제 #5
0
#------------------------------------------------------------------------
#Code Written by: Albert Lin from Noise Kitchen
#Current Project: noisekitchen.tw
#------------------------------------------------------------------------

#Step 1: Import necessary libraries 
#------------------------------------------------------------------------
import sys
import motor_lib
#------------------------------------------------------------------------

#Step 2: read the direction and number of steps; if steps are 0 exit 
#------------------------------------------------------------------------
try: 
    direction = sys.argv[1]
    laps = float(sys.argv[2])
    rpm= float(sys.argv[3])
    at= float(sys.argv[4])
    dt= float(sys.argv[5])
except:
    laps = 0

motor_lib.io1.wiringPiSetupGpio()
motor1 = motor_lib.stepperdriver(6400,13,19)
motor1.rotate(direction, laps,rpm,at,dt)