rogramming on the MH1905 Evaluation Board (EVB) using Python offers a straightforward approach to developing applications, especially with the Python 3.8 environment included in the Ubuntu image. This simple guide explains how to get started with basic Python programming on the MH1905 EVB, leveraging its powerful security modules for IoT applications.
In a previous article, we covered the installation of Ubuntu in user mode on the MH1905 EVB. With Python 3.8 pre-installed as part of this setup, developers can immediately begin creating scripts enhanced with extensive security functionality, including SSL and TLS modules. These features are invaluable for developing secure IoT applications that communicate with various IoT platforms.
Launching Python on MH1905To verify that Python is correctly installed and ready to use on your MH1905 EVB, follow these steps:
Access the Python Interpreter:- Open a terminal on the MH1905.
- Type python3 and press Enter. This command will open the Python 3.8 interpreter, indicating that Python is installed.
- Access the Python Interpreter:Open a terminal on the MH1905.Type python3 and press Enter. This command will open the Python 3.8 interpreter, indicating that Python is installed.
- In the Python interpreter, type:
- Explore Security Modules:In the Python interpreter, type:
help('modules')
- This will display a list of all available Python modules, including those related to SSL and TLS, confirming their availability for secure application development.
Let's create a simple Python script to demonstrate basic programming on the MH1905:
Create the Python File:- Using the vi editor, create a new file named "hello_world.py":
- Create the Python File:Using the vi editor, create a new file named "hello_world.py":
vi helloworld.py
- Enter the following Python code into the file:
import time
print("Hello World!")
time.sleep(1) # Adds a delay of 1 second
print("This is MH1905 EVB demo")
Run the Script:- Save the file and exit the vi editor.
- Run the script by typing:
- Run the Script:Save the file and exit the vi editor.Run the script by typing:
python3 hello_world.py
- The script will print "Hello World!" to the terminal and then wait for 1 second and print “This is MH1905 EVB Demo”
Programming on the MH1905 EVB with Python is a powerful yet simple way to develop applications, especially for those geared towards IoT and security. With the pre-installed Python 3.8 and security modules, developers can efficiently build applications that are secure and capable of interacting with various IoT platforms. This guide demonstrates that even those new to the MH1905 or Python can quickly start developing meaningful projects on this versatile board.
Comments
Please log in or sign up to comment.