sbcshop / MotorShield

Designed to help you get your Raspberry Pi based Robot. This board can control DC motor as well as the stepper motor. You can connect your IR and Ultrasonic sensors to tell your robot about its environment. You can easily make your Line Following, Object following, Wall following, Maze-Solver Robots.
https://shop.sb-components.co.uk/products/motorshield-for-raspberry-pi
53 stars 47 forks source link

Fix Test_Motor.py GPIO error, and add cleanup to Stepper_Test.py #13

Closed ronaldroe closed 5 years ago

ronaldroe commented 5 years ago

Pressing CTRL + C to end Test_Motor.py caused an error that GPIO was not defined. Additionally, GPIO would remain in its previous state prior to interrupt. Importing GPIO in Test_Motor.py clears the error and executes the cleanup successfully.

The keyboard interrupt was not added to Stepper_Test.py. Interrupting execution left the GPIO in its previous state prior to interrupt. Importing GPIO and adding the try: ... except: block with GPIO.cleanup() executes the GPIO cleanup.

sbcshop commented 5 years ago

Hi Ronaldroe,

We have updated the code as per your feedback on Motor Shield codes.

Regards