0

So I have a odd problem.

I have raspberry pi model 3 using gpiozero in python 3.

Just trying to turn on the motor at half speed when calling the function.

Issue is that nothing happens when function is called no power coming from pin 17 and no errors are generated and the "got this far" print command is successful, also code works perfectly when not inside the function.

I know the code is a bit redundant but it is because I have simplified it trying to get it to work without possible external interference.

Import gpiozero

def forwardboth():
    a = gpiozero.Motor(17, 18)
    a.forward(0.5)
    print('got this far')

forwardboth()
  • 1
    a will disappear as soon as the function exits – Milliways Jan 4 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.