Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use two motors at once #61

Closed
mortenmoulder opened this issue Jun 1, 2017 · 10 comments
Closed

Cannot use two motors at once #61

mortenmoulder opened this issue Jun 1, 2017 · 10 comments

Comments

@mortenmoulder
Copy link

mortenmoulder commented Jun 1, 2017

Hi, James! I absolutely love this project and I think it needs more attention. However, I have a weird issue: I cannot use two motors at once. The console outputs the same motor twice, but I know 100% sure I am using two different variables. Here's what my code looks like:

import l293d

motor1 = l293d.DC(15, 13, 11)
motor2 = l293d.DC(22, 18, 16)

motor1.clockwise()
motor2.clockwise()

I get this console output:

pi@raspberrypi:~ $ python3 motor.py
L293D driver version 0.2.4
Setting GPIO mode: BOARD
spinning motor at BOARD pins [22, 18 and 16] clockwise.
spinning motor at BOARD pins [22, 18 and 16] clockwise.

But you can clearly see I use different pins and different variables.

Confirmed not working for both Python 3.6 and 2.7.

Do you know why this is happening?

@jmsv
Copy link
Owner

jmsv commented Jun 1, 2017

Oh dear that doesn't look good - that was probably introduced when I changed how the package is imported. I'll make sure I can reproduce this and hopefully be able to fix this within the next hour.

Thanks so much for raising an issue and not abandoning the project! Raising this was extremely helpful and is more evidence that my tests need to be a lot better.

@mortenmoulder
Copy link
Author

mortenmoulder commented Jun 1, 2017

No problem! I prefer working with this over setting everything to HIGH or LOW all the time haha.

Thanks a lot!

Oh, btw, I used pip3 install l293d as well. I didn't clone this project, so let me know if that was a "mistake".

@jmsv jmsv closed this as completed in ce9adc0 Jun 1, 2017
@jmsv
Copy link
Owner

jmsv commented Jun 1, 2017

That should of fixed it (ce9adc0)

I'll push to PyPI in a second - your code should work after running pip install l293d --upgrade

@mortenmoulder
Copy link
Author

Works perfectly! Thanks a lot!

@jmsv
Copy link
Owner

jmsv commented Jun 1, 2017

Latest version is now on PyPI - I kept noticing things wrong so I ended up bumping the version a few times from 0.2.4 to 0.2.7

@jmsv
Copy link
Owner

jmsv commented Jun 1, 2017

Thanks again for opening this issue - this bug has been lingering for longer than I had originally thought

@mortenmoulder
Copy link
Author

mortenmoulder commented Jun 2, 2017

No worries, @jamesevickery! I got it all working and I think it's pretty good now!

PWM support would definitely be awesome to have as well, but I guess we can't have it all... yet haha.

@jmsv
Copy link
Owner

jmsv commented Jun 2, 2017

@mortenmoulder Thanks! If you want to contribute to PWM at all there's an issue at #56 - any ideas would be helpful and a code contribution would be even more so!

@mortenmoulder
Copy link
Author

Yeah I noticed that yesterday. If I had more knowledge with PWM and GPIO, I would give it a go, but unfortunately it's a bit out of my league right now 😞

@jmsv
Copy link
Owner

jmsv commented Jun 2, 2017

@mortenmoulder Don't worry 😀 I didn't really know anything about GPIO but just read lots of stuff online and experimented a bit - I've put a list of a few links that look helpful in the comments for #56, feel free to have a look. I'll have more of a look at PWM hopefully over the next few weeks.

@alxwrd alxwrd mentioned this issue Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants