BlocklyProp icon indicating copy to clipboard operation
BlocklyProp copied to clipboard

PWM blocks

Open VonSzarvas opened this issue 6 years ago • 3 comments

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.

VonSzarvas avatar Jul 30 '19 11:07 VonSzarvas

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.

MatzElectronics avatar Aug 19 '19 21:08 MatzElectronics

@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.

zfi avatar Sep 04 '19 20:09 zfi

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

MatzElectronics avatar Sep 08 '19 05:09 MatzElectronics