microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
721 stars 594 forks source link

Provide virtual servo in simulator for block servo set pulsepin #4063

Open edbye opened 3 years ago

edbye commented 3 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Unlike for the block servo write pin, that shows a virtual servo in the simulator, there is no representation of a servo for the "servo set pulsepin (us) block.

Describe the solution you'd like A clear and concise description of what you want to happen.

Could a representation of a servo be added to the "servo set pulsepin (us) block, please.

Perhaps some lower (500us) and upper (2500us) bounds would also need applying.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

An alternative would be to provide a new block to show the "set" pulse value e.g. keep keep exisitng block unchanged and have new block say "servo write pulsepin".

Additional context Add any other context or screenshots about the feature request here.

Showing a servo in the simualtor for this bloack would be useful for defining a custom range for various servos and also be more relavent to speed determination when using continuous servos.

Providing such a feature would make the the block much more useful to explore realtionship between native pulse width to angle.

abchatra commented 1 year ago

@edbye can you use the servo extension? Is there any reason to use the servo block from pin category?

martinwork commented 1 year ago

Arising from support tickets (private): https://support.microbit.org/helpdesk/tickets/62402 https://support.microbit.org/helpdesk/tickets/62403

Related: https://github.com/microsoft/pxt-microbit/issues/4062 https://github.com/microsoft/pxt-microbit/issues/5104 https://github.com/microsoft/pxt-microbit/issues/5105

@edbye replied to the email notification on this issue, but his reply didn't appear on GitHub. "The idea of my original request was to make things easier and more accessible for beginners, especially children. If you can not produce a block like that indicated by your reply in the Editor "pins" menu, then include the very useful "servo" package, you ref to in the standard editor distri. Either option would be appreciated and very useful."

@abchatra, I have been discussing this with @edbye, and it took me a while to realise that this issue was created in May 2021, and your question is Mar 2023. https://github.com/microsoft/pxt-microbit/issues/4062 received a question at the same time, and was immediately closed.

My understanding of the requirement is to introduce servos to beginners using full support for positional and continuous types in the simulator, then be able to move on to projects that need servos on pins other than P0, P1 and P2 using the same blocks. @edbye suggests that would ideally be by the Pins blocks gaining better continuous servo and simulator support, to avoid loading the extension.

@edbye has tried the Servo extension and found the problems in issues https://github.com/microsoft/pxt-microbit/issues/5104 and https://github.com/microsoft/pxt-microbit/issues/5105, namely that "stop servo" doesn't work in the simulator, and that the extension is limited to P0, P1 and P2.