[{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/331/original/IMG_0048.png?1700079046","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n        \u003cp\u003eRecently there was a \u003ca href=\"https://github.com/adafruit/circuitpython/pull/8580\" target=\"_blank\"\u003ePR merged into CircuitPython\u003c/a\u003e that allows for the mounting of a CIRCUITPY drive on an Android device. Previously this was not possible, so I wanted to try it out. For my testing, I used a Samsung Galaxy A13 phone running Android version 13. The board I used was a Circuit Playground Express running CircuitPython \u003ca href=\"https://github.com/adafruit/circuitpython/releases/tag/9.0.0-alpha.4\" target=\"_blank\"\u003e9.0.0-alpha.4\u003c/a\u003e.\u003c/p\u003e\n      \n\n\n","metadata":{}},{"element_type":"embed","content":"https://youtube.com/shorts/ZCI8Wb70Xhc"},{"element_type":"product","content":"https://www.adafruit.com/product/3333","metadata":{}},{"element_type":"text","content":"\n  \n  \n        \u003cp\u003eAfter plugging the CPX into my phone, I was able to see the drive in both Google Files and Android Files apps. In Google, it shows up as CIRCUITPY Drive and in Android it shows up as USB storage 1. \u003c/p\u003e\n      \n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/325/original/driveView.jpg?1700067083","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n        \u003ch2\u003eEdit\u003cstrong\u003e code.py\u003c/strong\u003e\n\u003c/h2\u003e\n\u003cp\u003eI tried a few text editor apps for opening and saving the \u003cstrong\u003ecode.py\u003c/strong\u003e file. My favorites were \u003ca href=\"https://play.google.com/store/apps/details?id=com.foxdebug.acodefree\u0026amp;hl=en_US\u0026amp;gl=US\u0026amp;pli=1\" target=\"_blank\"\u003eAcode (Google Play Store)\u003c/a\u003e, \u003ca href=\"https://play.google.com/store/apps/details?id=jp.sblo.pandora.jota.plus\u0026amp;hl=en_US\u0026amp;gl=US\" target=\"_blank\"\u003eJota+ (Google Play Store)\u003c/a\u003e and \u003ca href=\"https://f-droid.org/en/packages/org.billthefarmer.editor/\" target=\"_blank\"\u003eEditor (FDroid Store)\u003c/a\u003e. All three were easy to navigate, had minimal to zero ads and were able to successfully save an update to the \u003cstrong\u003ecode.py\u003c/strong\u003e file.\u003c/p\u003e\n\u003cp\u003eThere is one caveat though: you'll want to open \u003cstrong\u003ecode.py\u003c/strong\u003e thru your chosen text editor app, rather than opening the \u003cstrong\u003ecode.py\u003c/strong\u003e file in a Files app and choosing an app to open it with. In my testing, when I chose the latter, I received a security error when trying to save, which was very frustrating.\u003c/p\u003e\n      \n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/326/original/error.jpg?1700067220","metadata":{"caption":"don't open code.py this way"}},{"element_type":"alert","content":"Open your code.py file thru your chosen text editor app, otherwise you may get a security error when trying to save your updates.","metadata":{"class":"element row-fluid alert-element build-alert alert-warning","alert_type":"warning"}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eSo, you'll want to follow these steps when editing and updating \u003cstrong\u003ecode.py\u003c/strong\u003e:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eOpen your text editor app\u003c/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSelect Open...\u003c/strong\u003e from your text editor menu and navigate to your CIRCUITPY drive and select the \u003cstrong\u003ecode.py\u003c/strong\u003e file\u003c/li\u003e\n\u003cli\u003eMake your edits and save\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eI'll also note that it takes a little longer than you may be used to for the file to save and then reload on your device compared to using a desktop computer.\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/327/original/editFile.jpg?1700067964","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n        \u003ch2\u003eThe REPL\u003c/h2\u003e\n\u003cp\u003eI asked our resident Android expert FoamyGuy for some advice on where to start to access the REPL. He suggested the \u003ca href=\"https://play.google.com/store/apps/details?id=de.kai_morich.serial_usb_terminal\u0026amp;hl=en_US\u0026amp;gl=US\" target=\"_blank\"\u003eSerial USB Terminal app (Google Play Store)\u003c/a\u003e. The key feature for CircuitPython that this app has is the ability to create macros. With macros, you can setup CTRL+C and CTRL+D shortcuts that otherwise are impossible to do with the default Android keyboard.\u003c/p\u003e\n\u003cp\u003eTo create the macros, you'll \u003cstrong\u003elong press\u003c/strong\u003e on the macro button. Select \u003cstrong\u003eHEX\u003c/strong\u003e as the edit mode and value \u003cstrong\u003e03 for CTRL+C\u003c/strong\u003e. On a second macro, follow the same procedure and value \u003cstrong\u003e04 for CTRL+D\u003c/strong\u003e.\u003c/p\u003e\n      \n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/328/original/editMacro.jpg?1700068426","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eTo connect to your CIRCUITPY device, you'll press the \u003cstrong\u003eserial cable icon\u003c/strong\u003e at the top of the screen. You'll be asked to \u003cstrong\u003eallow access\u003c/strong\u003e to the CIRCUITPY device and you'll see \"Connected to CDC device\" appear in the terminal. You can press the \u003cstrong\u003eCTRL+C macro\u003c/strong\u003e to enter the REPL and interact with it as you would on your desktop computer.\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/329/original/repl.jpg?1700068648","metadata":{"caption":""}}]