Line 71... |
Line 71... |
71 |
self.spi.xfer([0x0A]) # KVAL_RUN |
71 |
self.spi.xfer([0x0A]) # KVAL_RUN |
72 |
self.spi.xfer([0x50]) |
72 |
self.spi.xfer([0x50]) |
73 |
self.spi.xfer([0x0B]) # KVAL_ACC |
73 |
self.spi.xfer([0x0B]) # KVAL_ACC |
74 |
self.spi.xfer([0x50]) |
74 |
self.spi.xfer([0x50]) |
75 |
self.spi.xfer([0x0C]) # KVAL_DEC |
75 |
self.spi.xfer([0x0C]) # KVAL_DEC |
76 |
self.spi.xfer([0x05]) |
76 |
self.spi.xfer([0x50]) |
77 |
# self.spi.xfer([0x18]) # CONFIG |
77 |
# self.spi.xfer([0x18]) # CONFIG |
78 |
# self.spi.xfer([0b00111000]) |
78 |
# self.spi.xfer([0b00111000]) |
79 |
# self.spi.xfer([0b00000000]) |
79 |
# self.spi.xfer([0b00000000]) |
80 |
|
80 |
|
81 |
def MaxSpeed(self, speed): |
81 |
def MaxSpeed(self, speed): |
Line 193... |
Line 193... |
193 |
print "Axis inicialization" |
193 |
print "Axis inicialization" |
194 |
X = axis(spi, 0, 641, MaxSpeed = SPEED) # set Number of Steps per axis Unit and set Direction of Rotation |
194 |
X = axis(spi, 0, 641, MaxSpeed = SPEED) # set Number of Steps per axis Unit and set Direction of Rotation |
195 |
|
195 |
|
196 |
print X.MaxSpeed(SPEED) # set maximal motor speed |
196 |
print X.MaxSpeed(SPEED) # set maximal motor speed |
197 |
|
197 |
|
198 |
print X.Run(1, 200.456431) |
198 |
#print X.Run(1, 200.456431) |
199 |
time.sleep(10) |
199 |
#time.sleep(10) |
200 |
''' |
200 |
|
201 |
print "Axis is running" |
201 |
print "Axis is running" |
202 |
for i in range(5): |
202 |
for i in range(5): |
203 |
print i |
203 |
print i |
204 |
X.MoveWait(DISTANCE) # move forward and wait for motor stop |
204 |
X.MoveWait(DISTANCE) # move forward and wait for motor stop |
205 |
print "Changing direction of rotation.." |
205 |
print "Changing direction of rotation.." |
206 |
time.sleep(1.1) |
206 |
time.sleep(1.1) |
207 |
X.MoveWait(-DISTANCE) # move backward and wait for motor stop |
207 |
X.MoveWait(-DISTANCE) # move backward and wait for motor stop |
208 |
print "Changing direction of rotation.." |
208 |
print "Changing direction of rotation.." |
209 |
time.sleep(1.1) |
209 |
time.sleep(1.1) |
210 |
''' |
210 |
|
211 |
X.Float(hard=False) # release power |
211 |
X.Float(hard=False) # release power |
212 |
|
212 |
|
213 |
finally: |
213 |
finally: |
214 |
print "stop" |
214 |
print "stop" |