🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Cardputer question - how to build text strings from user key strokes?

    UiFlow 2.0
    3
    8
    3.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BigAl2301
      last edited by

      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.

      dissyD 1 Reply Last reply Reply Quote 0
      • dissyD
        dissy @BigAl2301
        last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • P
          Peter
          last edited by

          @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.

          dissyD 1 Reply Last reply Reply Quote 0
          • dissyD
            dissy @Peter
            last edited by

            @peter Yes, that is perfectly OK with me. I'm glad you found it useful! Creating a module sounds like a wonderful idea

            1 Reply Last reply Reply Quote 0
            • P
              Peter
              last edited by

              I will inform you when it is available on the internet. What should I write as a copyright notice?

              dissyD 1 Reply Last reply Reply Quote 0
              • dissyD
                dissy @Peter
                last edited by

                @peter None needed. It is public domain

                P 1 Reply Last reply Reply Quote 0
                • P
                  Peter @dissy
                  last edited by

                  @dissy OK

                  1 Reply Last reply Reply Quote 0
                  • P
                    Peter
                    last edited by

                    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.

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post