I want to know how to keep the motor running until an interrupt arrives so I have control when the motor starts and stops. When i remove the sleep(2) line, the motor doesn't turn on. Anyone know why and how I can get around this?

The reason your motor stops is that you have the line p.stop() in your code which stops the pwm which in turn stops you motor.

You need to replace the sleep with what ever code you are going to use to await the interupt or await the command to stop the motor.

Please only ask questions in the forum I will not answer questions sent to me directly via PMRemember we want information.......................no information no helpThe use of crystal balls & mind reading is not supported

What motor driver are you using to run this motor as you can connect it directly to the gpio on the pi.

most H bridge motor drivers use 2 or 3 control wires per motor.

2 for direction which you drive high or low and one for enable this is normally the one you apply the pwm signal to that controls the speed.

if you are just using a simple single transistor then you apply the pwm signal to the base of the transistor and this turn on the motor and controls its speed.

Please only ask questions in the forum I will not answer questions sent to me directly via PMRemember we want information.......................no information no helpThe use of crystal balls & mind reading is not supported

from this example you should be able to work out how to control your motor.

Please only ask questions in the forum I will not answer questions sent to me directly via PMRemember we want information.......................no information no helpThe use of crystal balls & mind reading is not supported