Line 189... |
Line 189... |
189 |
while True: # set maximal motor speed |
189 |
while True: # set maximal motor speed |
190 |
key = pylirc.nextcode() ## preccessing the IR remote control commands. |
190 |
key = pylirc.nextcode() ## preccessing the IR remote control commands. |
191 |
|
191 |
|
192 |
if key == ['start']: |
192 |
if key == ['start']: |
193 |
running = True |
193 |
running = True |
194 |
X.Reset() |
- |
|
195 |
X.Initialize() |
- |
|
196 |
requested_speed = SPEED |
194 |
requested_speed = SPEED |
197 |
|
195 |
|
198 |
if key == ['faster']: |
196 |
if key == ['faster']: |
199 |
running = True |
197 |
running = True |
200 |
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 |
Line 210... |
Line 208... |
210 |
|
208 |
|
211 |
if running == True: |
209 |
if running == True: |
212 |
real_speed = X.Run(1, requested_speed) |
210 |
real_speed = X.Run(1, requested_speed) |
213 |
print "Motor running at: %f steps/s" % real_speed |
211 |
print "Motor running at: %f steps/s" % real_speed |
214 |
else: |
212 |
else: |
- |
|
213 |
X.Reset() |
- |
|
214 |
X.Initialize() |
215 |
X.Float(hard=False) # release power |
215 |
X.Float(hard=False) # release power |
216 |
print "Stopping the motor." |
216 |
print "Stopping the motor." |
217 |
|
217 |
|
218 |
except KeyboardInterrupt: |
218 |
except KeyboardInterrupt: |
219 |
print "stop" |
219 |
print "stop" |