Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:iot-open:scriptingprogramming [2023/08/24 20:22] – pczekalski | en:iot-open:scriptingprogramming [2024/03/05 13:42] (current) – [Programming with the use of scripts] pczekalski |
---|
==== Programming with the use of scripts ==== | |
| ====== Programming with the Use of Scripts ====== |
| {{: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 }}\\ |
Several programming models for IoT script programming are available. Depending on the hardware model used (SoC or OS-based MCU), it may involve single script execution (e.g. Raspberry Pi Pico RP2040, Edge-class IoT) or multithreaded, parallel, multiple scripts, doing multiple tasks (e.g. Raspberry Pi 4, Fog-class IoT). The idea and model of the scripting programming for SoC class devices (edge) were presented in the chapter [[en:iot-open:introductiontoembeddedprogramming2|Script Programming with Middleware]].\\ In the case of far more powerful, Fog-class IoT devices that are OS-based devices, a variety of programming languages and, thus, scripting interpreters are available. | Several programming models for IoT script programming are available. Depending on the hardware model used (SoC or OS-based MCU), it may involve single script execution (e.g. Raspberry Pi Pico RP2040, Edge-class IoT) or multithreaded, parallel, multiple scripts, doing multiple tasks (e.g. Raspberry Pi 4, Fog-class IoT). The idea and model of the scripting programming for SoC class devices (edge) were presented in the chapter [[en:iot-open:introductiontoembeddedprogramming2|Script Programming with Middleware]].\\ In the case of far more powerful, Fog-class IoT devices that are OS-based devices, a variety of programming languages and, thus, scripting interpreters are available. |
| |
Among others, the most common scripting languages for fog class devices are : | Among others, the most common scripting languages for fog class devices are : |
* Bash scripting (OS command scripting) usually does not provide support for the GPIO, intended to automate OS tasks; | * Bash scripting (OS command scripting) usually does not provide support for the GPIO, intended to automate OS tasks, |
* Python scripting, cross-platform for both Edge-class devices (Micrpython) and Fog-class (regular Python, usually run on Linux); | * Python scripting, cross-platform for both Edge-class devices (Micrpython) and Fog-class (regular Python, usually run on Linux), |
* C#, limited to the Windows IoT for Raspberry Pi; | * C#, limited to the Windows IoT for Raspberry Pi. |
| |
=== Bash scripting === | === Bash scripting === |
=== Python === | === Python === |
Python programming for IoT devices is dual: | Python programming for IoT devices is dual: |
* [[en:iot-open:scriptingprogramming:pythonfundamentals]] Regular Python interpreter can be used in Fog class devices such as Raspberry Pi and its clones. In this case, the Python interpreter is run as a separate process in the Linux OS, the same way as in regular PC computers. It has full access to the GPIO, however. | * Regular Python interpreter can be used in Fog class devices such as Raspberry Pi and its clones. In this case, the Python interpreter is run as a separate process in the Linux OS, the same way as in regular PCs. It has full access to the GPIO, however. |
* [[en:iot-open:scriptingprogramming:micropythonfundamentals]] Micropython is dedicated to SoCs and is distributed as the firmware that must be flashed into the device. It is common that Micropython exposes serial communication on dedicated pins, exposing a Python console that looks similar to the command line Python interface in the PCs | * Micropython is dedicated to SoCs and is distributed as the firmware that must be flashed into the device. Commonly, Micropython exposes serial communication on dedicated pins, exposing a Python console that looks similar to the command line Python interface in the PCs |
=== C# .NET === | === C# .NET === |
[[en:iot-open:scriptingprogramming:csharpfundamentals]] When writing this publication, the .NET framework with C# interpreter is available only for Raspberry Pi devices as a part of the Windows IoT operating system ((https://dotnet.microsoft.com/en-us/apps/iot)). | When writing this publication, the .NET framework with C# interpreter is available only for Raspberry Pi devices as a part of the Windows IoT operating system ((https://dotnet.microsoft.com/en-us/apps/iot)). It is a niche, still fully functional and solid solution. Its newer versions are available only as a commercial product, however. |
| <WRAP excludefrompdf> |
<todo @pczekalski>Add existing pages with C# and Python for RPI</todo> | In the following chapters there is a brief introduction to programming with scripts for IoT devices in Python and C#: |
<todo @pczekalski>Author a course on Micropython</todo> | * [[en:iot-open:scriptingprogramming:pythonfundamentals]], |
| * [[en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:raspberrypi_rpi:programming_fundamentals_winiot]]. |
| </WRAP> |