quickstart.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Quickstart
  2. ==========
  3. This page provides some details on how to start and use the application.
  4. Basics
  5. ------
  6. How to install the application and run a script:
  7. 1. Install the application from the `Flipper Lab <https://lab.flipper.net/apps/upython>`_ on your Flipper device.
  8. 2. Write some Python code or use one of the provided `examples <https://github.com/ofabel/mp-flipper/tree/master/examples>`_.
  9. 3. Use the `qFlipper <https://flipperzero.one/update>`_ application to upload the code to your Flipper's SD card.
  10. 4. Start the **uPython** application on your Flipper to run your Python script.
  11. Instead of running a script, you could also use the interactive MicroPython shell from the terminal.
  12. Visit the `Flipper documentation <https://docs.flipper.net/development/cli>`_ for details about the CLI in general.
  13. .. hint::
  14. Looking for a more efficient solution to copy your files or start a CLI session?
  15. Try the `Flipper Zero Script SDK <https://github.com/ofabel/fssdk>`_ helper.
  16. In case your Flipper is not responding or a script doesn't behave as expected and won't finish: `do a reboot <https://docs.flipper.net/basics/reboot>`_ by pressing and holding **Left** and **Back** for 5 seconds.
  17. Usage
  18. -----
  19. Due to the occasional crashes upon application start, the application is especially designed to run in the background while working on the CLI from the computer.
  20. You can use the CLI to start the application:
  21. .. code-block:: shell
  22. loader open /ext/apps/Tools/upython.fap
  23. You can also use the CLI to start the application and run a Python script:
  24. .. code-block:: shell
  25. loader open /ext/apps/Tools/upython.fap /ext/scripts/tic_tac_toe.py
  26. Once the application is up an running, it registers the **py** command in the Flipper's CLI command registry.
  27. You can use this command to access the interactive MicroPython shell or start a script by passing the path as an argument:
  28. .. code-block:: shell
  29. py /ext/scripts/tic_tac_toe.py
  30. Be aware, that the **py** command is only available as long as the application is running on the Flipper.
  31. Furthermore, you can only run one script at the time.