1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- import time, sys, signal, atexit
- import pyupm_l298 as upmL298
-
-
-
-
- myHBridge = upmL298.L298(3, 4, 7)
-
-
-
-
- def SIGINTHandler(signum, frame):
- raise SystemExit
-
-
-
- def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-
- atexit.register(exitHandler)
- signal.signal(signal.SIGINT, SIGINTHandler)
-
-
- print "Starting motor at 50% for 3 seconds..."
- myHBridge.setSpeed(50)
- myHBridge.setDirection(upmL298.L298.DIR_CW)
- myHBridge.enable(True)
-
- time.sleep(3)
-
- print "Reversing direction..."
- myHBridge.setDirection(upmL298.L298.DIR_NONE)
- myHBridge.setDirection(upmL298.L298.DIR_CCW)
- time.sleep(3);
-
- myHBridge.setSpeed(0)
- myHBridge.enable(False)
-
|