Suggestion to add chr() function to UI Flow



  • Hi, I am new to M5Stack. I just began experimenting with a Core2 (fw V1.9.3). Via I2C/Grove connected a M5Stack CardKB. Reading keypresses from the CardKB go OK. But I want to print their ASCII equivalent to the Core2 display. In Python one would use the function chr(int_value) but this does not exist (as far as my experience goes). An altertive I tried with success is create a lookup Dictionary (called Maps in UI Flow) but one has to create a relatively large Map to cover all the key values and their respective ASCII values (between 32 and 127). If we compare this with a simple instruction chr() the difference is big. The size of the script could be much more short.
    That is why I post here this suggestion for the maintainers of the UI Flow IDE to add in the TEXT secition a block similar to "convert to str" a "convert int to ascii", "convert with chr()" or any other suitable phrase.



  • Hello @Paulskpt

    some functionality which is not directly available as block can still be used via the Execute code block from the Advanced section. I've just tried that and chr() can be used that way.

    Thanks
    Felix



  • @felmue thank you very much. I go to try that. In the mean time I discovered that the function cardkb_getstring covers more or less what I wanted to achieve.