Line 53... |
Line 53... |
53 |
self.spi.xfer([0x10]) |
53 |
self.spi.xfer([0x10]) |
54 |
self.spi.xfer([0x06]) # DEC |
54 |
self.spi.xfer([0x06]) # DEC |
55 |
self.spi.xfer([0x00]) |
55 |
self.spi.xfer([0x00]) |
56 |
self.spi.xfer([0x10]) |
56 |
self.spi.xfer([0x10]) |
57 |
self.spi.xfer([0x0A]) # KVAL_RUN |
57 |
self.spi.xfer([0x0A]) # KVAL_RUN |
58 |
self.spi.xfer([0x50]) |
58 |
self.spi.xfer([0x20]) |
59 |
self.spi.xfer([0x0B]) # KVAL_ACC |
59 |
self.spi.xfer([0x0B]) # KVAL_ACC |
60 |
self.spi.xfer([0x50]) |
60 |
self.spi.xfer([0x20]) |
61 |
self.spi.xfer([0x0C]) # KVAL_DEC |
61 |
self.spi.xfer([0x0C]) # KVAL_DEC |
62 |
self.spi.xfer([0x50]) |
62 |
self.spi.xfer([0x20]) |
63 |
self.spi.xfer([0x18]) # CONFIG |
63 |
self.spi.xfer([0x18]) # CONFIG |
64 |
self.spi.xfer([0b00111000]) |
64 |
self.spi.xfer([0b00111000]) |
65 |
self.spi.xfer([0b00000110]) |
65 |
self.spi.xfer([0b00000110]) |
66 |
|
66 |
|
67 |
def MaxSpeed(self, speed): |
67 |
def MaxSpeed(self, speed): |
Line 197... |
Line 197... |
197 |
running = True |
197 |
running = True |
198 |
requested_speed = SPEED * 1.2 # runnig the motor at 120% of the base motor speed |
198 |
requested_speed = SPEED * 1.2 # runnig the motor at 120% of the base motor speed |
199 |
|
199 |
|
200 |
if key == ['slower']: |
200 |
if key == ['slower']: |
201 |
running = True |
201 |
running = True |
202 |
requested_speed = SPEED * 0.8 |
202 |
requested_speed = SPEED * -1.2 |
203 |
|
203 |
|
204 |
if key == ['stop']: |
204 |
if key == ['stop']: |
205 |
running = False |
205 |
running = False |
206 |
|
206 |
|
207 |
time.sleep(0.1) |
207 |
time.sleep(0.1) |
Line 221... |
Line 221... |
221 |
sys.exit(0) |
221 |
sys.exit(0) |
222 |
|
222 |
|
223 |
except Exception, e: |
223 |
except Exception, e: |
224 |
X.Float(hard=False) # release power |
224 |
X.Float(hard=False) # release power |
225 |
print >> sys.stderr, "Exception: %s" % str(e) |
225 |
print >> sys.stderr, "Exception: %s" % str(e) |
226 |
sys.exit(1) |
- |
|
227 |
|
226 |
sys.exit(1) |
- |
|
227 |
|