-
Notifications
You must be signed in to change notification settings - Fork 638
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
Create a generic ‘Pause Until’ block for micro-bit (like the block in Makecode for EV3) #5919
Comments
I brought this up with the team, and opinions were torn on whether to add this to the toolbox; the main concern was that adding another block to the default toolbox might be overwhelming. We also discussed where to put it if we were to add it, with the main suggestions being the basic category (which is where the pause block is), loops (which is where it is in our other editors, somewhat arbitrarily), or control (which has the benefit of being in the "advanced" section and has similar blocks already) Personally, I prefer control since it's out of the way and also is where we put the other pause/wait variants, including this one: @microbit-carlos @jaustin @Jaqster would love to hear feedback on this |
Thanks for the feedback! Personally I would argue for adding it to the basic category. I appreciate the concern with regards to "block overload" but I think especially for younger users this would greatly simplify sequence tasks which would otherwise need some form of 'pause loops'. With this in mind the basic category would be most helpful. But in the end I would be grateful to have it, regardless of category! |
@riknoll the pause until block in ev3 is in cycles, which is logical, since it essentially defines a loop while that checks the event... |
i believe it is functionally equivalent to the while loop example you provide. the only advantage is, as you said, better wording plus only needing one block vs three |
Hello!
A 'Pause Until' block would make this kind of code really easy and clean. Thanks! |
Hello! In any case, if the concern is that too many blocks are exposed i the standard toolbox then I would also be very happy to have it in the advance section. |
Hi @mpoelzl are you working with students inside a context where you are able to share code with them in advance? If so, you could make this a custom block inside the pre-shared example. Another option would be to make this a small standalone extension These have the upside of making the code available to you, but the downside that if you share example code that includes this block, students may later fail to find it when using Makecode without your example. If you publish an extension you can show them how to add it, but that is probably more complicated than just sharing the blocks. OTOH, it's also a nice opportunity to introduce students to functions. If you would like to express this as a custom block or in an extension, I'm happy to help you do that. |
Hello! Just to add, this was already discussed here (and you can see the problem) and the feecback was that it is currently not possible to create this in an extension: https://forum.makecode.com/t/create-a-generic-pause-until-block/30448 |
@riknoll in order to test this from an extension, would enabling this feature in |
@microbit-carlos not sure what you mean by that. are you talking about code size? if so, that's not an issue. pauseUntil is already available today in TS we just hid the block for it. @mpoelzl it's true that you can't create a block that takes a predicate like the pauseUntil block, but you can create a higher level block in an extension that calls pauseUntil. for example, if you had some sort of distance sensor: namespace custom {
//% block="pause until object detected $distance cm away"
export function pauseUntilDistance(distance: number) {
pauseUntil(() => sensor.distance() <= distance)
}
} |
@riknoll Thank you, but the aim really is to have a generic block that takes any predicate. |
I am trying to create a ‘Pause Until’ block that can take a function with a boolean return value and pauses until it turn true. Makecode for the EV3 has such a block but not Makecode for micro:bit.
I can create the function but the corresponding block does not look as it should. Specifically it does not have the ‘pointy’ parameter placeholder where a boolean input can be placed.
As discussed here it is something that already exists and could be added: https://forum.makecode.com/t/create-a-generic-pause-until-block/30448
Would it be possible to make this block availble in Makecode for micro:bit?
Thank you!
The text was updated successfully, but these errors were encountered: