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

Support for PulseIn #30

Closed
wallarug opened this issue May 4, 2019 · 2 comments
Closed

Support for PulseIn #30

wallarug opened this issue May 4, 2019 · 2 comments

Comments

@wallarug
Copy link
Contributor

wallarug commented May 4, 2019

Hi,

Is there support for pulseio.PulseIn somewhere in SeeSaw?

I can see that it is mentioned but I am unsure how to use it with SeeSaw.

There is CircuitPython support. I have this example working in CircuitPython, however, not worked out how to port it across to SeeSaw. If someone could point me in the right direction or say: "implement it please", that would be great!

from pulseio import PWMOut, PulseIn, PulseOut
from adafruit_motor import servo
from array import array
import time

steering_channel = PulseIn(board.RCH1)
throttle_channel = PulseIn(board.RCH2)
pwm1 = PWMOut(board.SERVO1, duty_cycle=2 ** 15, frequency=50)
pwm2 = PWMOut(board.SERVO2, duty_cycle=2 ** 15, frequency=50)
steering_servo = PulseOut(pwm1)
throttle_servo = PulseOut(pwm2)

while True:    
    while len(throttle_channel) == 0:
        pass
    throttle_channel.pause()  
    throttle_servo.send(array('H', [(throttle_channel[0])]))
    throttle_channel.resume()
    time.sleep(0.01)

Thanks in advance.

@ladyada
Copy link
Member

ladyada commented May 4, 2019

implement it please :)

@wallarug
Copy link
Contributor Author

wallarug commented May 5, 2019

No worries 😜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants