pybricks / support

Pybricks support and general discussion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Add block for read_input_byte

laurensvalk opened this issue · comments

Is your feature request related to a problem? Please describe.
Keyboard input is a fairly common use case.

Describe the solution you'd like
Somehow provide keyboard input. A block to match read_input_byte might be good for that.

It could be used as is, or perhaps with a small wrapper to convert to a character if within valid range.

Not just for blocks, but also for Python this function could potentially be a bit more multi-purpose with two additional parameters:

  • chr=False: Whether to apply the chr() function to the resulting byte.
  • last=False: Whether to discard everything but the last value.

Use case: keyboard remote control where you just care about the last press and with a helpful translation to the key if it exists.

Now released in latest beta.