Python comes to the Casio fx-CG 50
|
12-26-2024, 06:38 PM
Post: #40
|
|||
|
|||
RE: Python comes to the Casio fx-CG 50
(This 4-year old thread seems to be the most appropriate for my comments...)
I tried creating a few MicroPython programs on my Casio fx-CG50 for the first time. I can describe the experience in a few words: awful, terrible, horrible, frustrating. One of the first things I tried was a 2-line program to read a string from the keyboard, and printing it out: Code: s = input("s?") Problem 1: It is *extremely* tedious to type alpha-letters on a non-QWERTY calculator keyboard with the letters distributed seemingly randomly: most rows have 6 letters, 1 row has 3 letters, and the 'z' appears by itself on the last row. It takes forever to find the letter that I want. I wanted to throw the calculator across the room after a few minutes. Problem 2: The color scheme of the ALPHA letters is not very good: dark-red on black background. It makes the letters difficult to read except in bright light conditions. Problem 3: When I run the above simple program, I get the prompt "s?". Then I want to type a string containing some ASCII symbols, like '%', '$', '\' (backslash), '&'. Those symbols are not exposed to the Casio keyboard, and the `input()` function provides no access to those symbols as far as I can tell. Some of the math function buttons are bound to their Python equivalents. For example, pressing the `sin` button enters the string "sin()". And pressing the `x^2` button enters the string "**2". But I cannot see anyway to enter most ASCII symbols during the `input()` function. (If you thought that SHIFT CATALOG would be available during the `input()`, you would be mistaken like me.) Problem 4: The CG50 ships with a very old version of MicroPython, v1.9.4 (I don't recall which version of Python3 this corresponds to, maybe 3.4?). It does not support many features of Python3 that normal Python programmers would expect. Two examples that I ran into quickly: 4a) It does not support Unicode. In other words, entering the following in REPL mode (called "SHELL" in the Casio menu) produces an exception: Code: >>> chr(256) 4b) It does not support the new Python3 f-strings. For example, `f"{254:2X}"` is supposed to print "FE" (hexadecimal of 254). But on the Casio, this is a syntax error. In contrast, the Linux version of MicroPython (e.g. v1.17) and the MacOS version of MicroPython (e.g. v1.24) support both Unicode and f-strings. Problem 5 The built-in editor has a limit of 300 lines, of 255 characters per line. In reality, I'm not sure that these limits actually matter, since it is so painful to create and edit programs on the calculator. Workarounds The only way I could do anything productive with the Casio MicroPython environment, was to enter my program on my laptop using a real editor and a real keyboard. Then debug the program on the laptop using the desktop version of MicroPython. Then upload the *.py file to the Casio calculator using the USB cable. There is no workaround for the lack of Unicode. But f-strings can be replaced with the OG old-school '%' operator. In other words, `f"{254:2X}"` can be written as `"%2X" % 254`. Summary The on-board MicroPython programming environment on the Caiso fx-CG50 calculator is awkward and unproductive. Without a QWERTY keyboard, it is time-consuming and frustrating to type anything non-trivial on the calculator. In some contexts (e.g. the input() function), it is impossible to enter many ASCII symbols that are found on normal computer keyboards. The version of MicroPython on the CG50 is too old and not compatible with modern Python3. It is not clear to me how the Python environment on the CG50 is useful for anything. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)