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

PWM blocks #1698

Open
VonSzarvas opened this issue Jul 30, 2019 · 3 comments
Open

PWM blocks #1698

VonSzarvas opened this issue Jul 30, 2019 · 3 comments
Assignees

Comments

@VonSzarvas
Copy link

possible bug

Calling pwm_set in code auto-injects pwm_start after main. Good and works fine.

Then...

Calling pwm_stop stops pwm output and kills the cog. Good so far. Code can now use that IO pin for other important stuff.

Then...

Calling another pwm_set doesn't appear to re-start (pwm_start) the cog. Oops.

@MatzElectronics
Copy link
Collaborator

I think the best way to solve this is to change the PWM_stop block to have a dropdown where the default is "stop" and contains "stop" and "start" as options.

@Steph-Parallax @VonSzarvas, thoughts?

The other option would be to do some fancy auto-detect stuff where if a stop block is detected further up the block "stack", it would then insert pwm_start() directly above the pwm_set() call.

@zfi
Copy link
Contributor

zfi commented Sep 4, 2019

@MatzElectronics, can you create and attach a sample project that exercises this issue @VonSzarvas reported? We can then have someone else test that to verify that it's happy now.

@MatzElectronics
Copy link
Collaborator

Sorry I haven't gotten to this one very quickly.

I'm not sure what @VonSzarvas https://github.com/VonSzarvas was working
on when he reported this, but the attached project should exercise it. The
idea is that you'll run PWN on P26 on an ActivityBoard or a FLiP, and you
should see the light start dim and then get brighter. Then, it will stop
the PWM for 3 seconds - during those 3 seconds it will simply blink the
light. Then, it will go from dim to bright again after turning the PWM
back on.

image

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

3 participants