Added example code snippet

This commit is contained in:
Vijay Janapa Reddi
2023-09-16 11:15:30 -04:00
parent 10d3738719
commit cb5b908b57

View File

@@ -143,7 +143,17 @@ The selection of appropriate programming languages is crucial in embedded system
- **C++**: Building on the foundation laid by C, C++ integrates object-oriented principles, fostering organized and modular code development. Despite its inherent complexity, it is embraced in scenarios where higher-level abstractions do not compromise the granular control provided by C.
- **Python**: While not a classic choice for embedded systems due to its relative memory consumption and runtime delays, Python is finding its place in the embedded domain, especially in systems where resource constraints are less stringent. In recent times, a variant known as MicroPython has emerged, specifically tailored for microcontrollers. [MicroPython](https://micropython.org/) retains the simplicity and ease of use of Python while being optimized for embedded environments, offering a flexible programming paradigm that facilitates rapid prototyping and development.
- **Python**: While not a classic choice for embedded systems due to its relative memory consumption and runtime delays, Python is finding its place in the embedded domain, especially in systems where resource constraints are less stringent. In recent times, a variant known as MicroPython has emerged, specifically tailored for microcontrollers. [MicroPython](https://micropython.org/) retains the simplicity and ease of use of Python while being optimized for embedded environments, offering a flexible programming paradigm that facilitates rapid prototyping and development. For instance, the code snipped below shows how we can use MicroPython to interface with the pins on a [PyBoard](https://store.micropython.org/).
```python
import pyb # Package from PyBoard
# turn on an LED
pyb.LED(1).on()
# print some text to the serial console
print('Hello MicroPython!')
```
**Comparison with Traditional Systems**:
In stark contrast to conventional systems, where languages like Java, Python, or JavaScript are celebrated for their development ease and comprehensive libraries, embedded systems are geared towards languages that offer refined control over hardware components and potential optimization opportunities, carefully navigating the limited resources at their disposal.