mBot2 Cyberpi missing "When key is released"


#1

Hey there !

I’m using mBots V1 with my students for a while now.
Recently i moved to mBots 2 with the cyberpi module.

Before, on mBlock 5 i was able to add the mBlock 3 extension to add the “when key is released” block but with the cyberpi and the mBot chassis extension, it’s not possible…
I want them to discover the bot by controling it with the keyboard while connected and the bot not stoping upon releasing key is not a solution with student driving the bot on their tables…

Any ideas on what i could do ? I saw some methods here but many of them lag and some are not suitable for young students to master…

In advance thanks !
regards,
Florian


#2

Would this code work?
image
It is fairly simple (three blocks, plus your code) and not at all laggy.


#3

Hey there,

Thanks for your reply !

This code works well with the onboard buttons but as i’m trying to make them remote control the bot with the keyboard i’m not sure i’ll be able to use the same method !

Thanks anyway and i’m going to check if i can modify my activity to pilot the bot with the onboard joystick !

Regards,
Florian


#4

No problem!
Another solution:
Go to the “Sprite” tab:
image
Add the extension:
image
Broadcast “message” when the space key is released:
image
Go back to the device tab:
image
Run your code when the device receives the message:
image

This method has no lag and is fairly simple (four blocks). Hope it helps!


#5

You’re a real Hero !

Many thanks !

I’ll try that asap !

Regards,
Florian


#6

Thanks a lot! I’m glad I could help.


#7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.