DESK-MX8M-L/Development/Application examples/Hello World Python example

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2024/06/17 DESK-MX8M-L-4.x.x release



Hello World Python example[edit | edit source]

Here below is an example of Python code displaying the classic Hello World! message on the target serial console.

Python3 environment[edit | edit source]

In the DESK-MX8M-L development environment, python3 package has been already installed in the Yocto dave-image-devel target image.

For more information on using Python see this Application Note

root@desk-mx8mp:~# python3
Python 3.10.7 (main, Sep  5 2022, 13:12:31) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

It is enough to create the the hello.py Python source code file:

root@desk-mx8mp:~# echo 'print("Hello, World!")'  > hello.py
root@desk-mx8mp:~#

and execute it by invoking Python3:

root@desk-mx8mp:~# python3 hello.py
Hello, World!
root@desk-mx8mp:~#