Cardputer question - how to build text strings from user key strokes?
-
In UiFlow 2, how to use coding blocks to simply get keystrokes from a user and form into a string, ended by the Enter key? It would seem that this should be something simple, in the Text category of blocks. A List doesn't seem to be an answer. Nor does a ByteArray. Am I missing something? The "Prompt for User Input" block in Text category does nothing. Thanks.
-
@bigal2301 Unfortunately there isn't a built-in keyboard buffer handler block.
There is a keypress event handler which is good, but it seems designed so you can't both get a key code and the key string at the same time. This makes it tricky to handle 'special' keys.
I just threw together an example called "Example Keyboard Buffer" in the project zone.
It handles enter with a function, handles the delete key, and filters out tab/escape.
Much of the code is comments explaining things as well as a small scroll buffer on screen. -
@dissy
Hello dissy, thank you very much for your keyboard script. I have just spent a few hours trying to bring the Cardputer keyboard to life. Your program got me on the right track.
I am currently writing a manual on how to use the cardputer with micropython in German. I would like to use your script as a Micropython module and make it available for download on my website, with your authorship of course. Do you agree with this?
My website: https://micropython.aundz.net/index.php?title=M5CardComputer is still a work in progress.
Thank you very much. -
@peter Yes, that is perfectly OK with me. I'm glad you found it useful! Creating a module sounds like a wonderful idea
-
I will inform you when it is available on the internet. What should I write as a copyright notice?
-
@peter None needed. It is public domain
-
@dissy OK
-
Hi,
my Micropython Modul ist ready to use: http://micropython.aundz.net/index.php?title=M5CardComputer_Keyboard#Ein_Modul_zur_Keyboardabfrage
It is to use with Micropython (Thonny) not with UIFlow!
M5Stack uses 2 spaces for indentation, I used 4 spaces as it is standard in Micropython.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login