Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:scriptingprogramming:micropythonfundamentals [2023/10/01 18:08] – ToDo checked: Intro to Micropython, explain the idea, installation concept (e.g. RP2040), compare to regular one (move "note" from hardware section) and present sample coding using terminal (GKTerm). pczekalskien:iot-open:scriptingprogramming:micropythonfundamentals [2024/05/24 09:54] (current) – [Installation] pczekalski
Line 1: Line 1:
-===  ===  +======Micropython====== 
-<box #5374d5></box> +{{:en:iot-open:czapka_b.png?50| General audience classification icon }}{{:en:iot-open:czapka_m.png?50| General audience classification icon }}{{:en:iot-open:czapka_e.png?50| General audience classification icon }}\\
-<box #5374d5></box> +
-===Micropython=== +
-<box #5374d5></box> +
-<box #5374d5></box> +
 MicroPython implements the Python programming language optimized for microcontrollers and embedded systems that are resource-constrained devices. It is simple and enables rapid prototyping. MicroPython implements the Python programming language optimized for microcontrollers and embedded systems that are resource-constrained devices. It is simple and enables rapid prototyping.
  
Line 16: Line 11:
   - MicroPython has a growing community, shared libraries and sample projects. A package manager called "upip" also enables the installation of additional MicroPython libraries easily.   - MicroPython has a growing community, shared libraries and sample projects. A package manager called "upip" also enables the installation of additional MicroPython libraries easily.
   - MicroPython is released under an open-source license (typically the MIT License).   - MicroPython is released under an open-source license (typically the MIT License).
-  - MicroPython is designed to be power-efficient, which is crucial for battery-powered and energy-constrained devices.+  - MicroPython is designed to be power-efficient, crucial for battery-powered and energy-constrained devices.
   - While Micropython is not a real-time operating system (RTOS) itself, it can be used in conjunction with RTOSes to build real-time systems, if only needed.   - While Micropython is not a real-time operating system (RTOS) itself, it can be used in conjunction with RTOSes to build real-time systems, if only needed.
   - MicroPython is a popular choice for educational purposes: thanks to REPL, the setup of the SDK is simple and quick.   - MicroPython is a popular choice for educational purposes: thanks to REPL, the setup of the SDK is simple and quick.
  
  
-== Installation == +===== Installation ===== 
-Installation of the Micropython usually involves flashing firmwarespecific for a microcontroller, that contains a Python interpreter and becomes de-facto a middleware between hardware and developer that is used with means of scripts. Micropython scripts can be executed inline via terminal (REPL), or a file with source code (usually named ''main.py'') can be uploaded to the drive's root folder exposed via USB connection by the MCUs firmware.+Installation of Micropython usually involves flashing firmware specific to a microcontroller. This firmware contains a Python interpreter and becomes de facto a middleware between hardware and developer used with scripts. Micropython scripts can be executed inline via terminal (REPL), or a file with source code (usually named ''main.py'') can be uploaded to the drive's root folder exposed via USB connection by the MCU firmware.
  
-A website that is a starting point for Micropython is micropython.org((https://micropython.org)).+A website that is a starting point for Micropython is Micropython.org ((https://micropython.org)).
  
 The installation procedure is specific to the hardware platform and sometimes differs slightly from flashing C++-based solutions or burning an OS, as in the case of the RP2040. The main steps to prepare a working environment are presented below: The installation procedure is specific to the hardware platform and sometimes differs slightly from flashing C++-based solutions or burning an OS, as in the case of the RP2040. The main steps to prepare a working environment are presented below:
   * Download a Micropython binary image suitable for your hardware.   * Download a Micropython binary image suitable for your hardware.
   * Switch the MCU into the bootloader mode that exposes a flash drive: in the case of the RP2040, the easiest way is to hold down the //Bootsel// button and power on the device while holding.   * Switch the MCU into the bootloader mode that exposes a flash drive: in the case of the RP2040, the easiest way is to hold down the //Bootsel// button and power on the device while holding.
-  * Move the firmware file into the flash drive; the device will flash and reboot.+  * Move the firmware file into the flash drive; the device will flash the file to the memory and reboot.
   * Connect to the serial port exposed.   * Connect to the serial port exposed.
  
-== Development == +===== Development ===== 
-Once Micropython is installed in the device, it exposes a terminal (REPL) via serial port, either on the dedicated GPIOs for serial or via serial over USB. Developing directly inline is possible (samples are presented in the following chapters), but is not convenient for complex code. Complex and multi-file solutions can benefit from uploading files (even multiple) to the device. A file named ''main.py'' is automatically executed on device restart.+Once Micropython is installed in the device, it exposes a terminal (REPL) via serial port, either on the dedicated GPIOs for serial or via serial over USB. Developing directly inline is possible (samples are presented in the following chapters), but it is not convenient for complex code. Complex and multi-file solutions can benefit from uploading files (even multiple) to the device. A file named ''main.py'' is automatically executed when the device restarts.
  
 IDEs use those features to simplify development and enable remote code authoring and execution. IDEs use those features to simplify development and enable remote code authoring and execution.
-<todo @pczekalski #pczekalski:2023-10-01>Intro to Micropython, explain the idea, installation concept (e.gRP2040), compare to regular one (move "note" from hardware sectionand present sample coding using terminal (GKTerm).</todo>+ 
 +Sample Micropython development toolchain installation with Thonny IDE one can find on the web ((https://learn.sparkfun.com/tutorials/pro-micro-rp2040-hookup-guide/examples-micropython)). This guide presents development using RP2040. 
 + 
en/iot-open/scriptingprogramming/micropythonfundamentals.1696183703.txt.gz · Last modified: 2023/10/01 18:08 by pczekalski
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0