-
I'm having great success with pybricks and my Mindstorms hub and so I thank the developers for their efforts. After successfully programming a colour sorter with pybricks I decided to try a remote control project. I have a simple wheeled vehicle that I'm controlling with code based on the keyboard example code (the 4WD example uses very similar code). I'm using the arrow keys for direction and any other key to stop. However, if instead of pressing a key to stop the motor I'm wondering if I could simply release the forward key, for example, to stop the motor. I don't think it's possible to detect a released key but I thought I'd ask in case I've missed something. From what I see on YouTube the Powered Up remote does allow a motor to stop just by releasing the button. I'll investigate this further. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The current method of using |
Beta Was this translation helpful? Give feedback.
The current method of using
stdin
doesn't actually detect key events, but rather the characters that would appear in a terminal as a result of typing. So if you keyboard is configured to automatically repeat characters when it is held down, you could detect the release of a key by the lack of repeating characters.