BlocklyProp
BlocklyProp copied to clipboard
PWM blocks
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.
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, 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.
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.
