You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/content.md
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,11 @@ hardware:
12
12
13
13
## Overview
14
14
15
-
The container infrastructure provided by Arduino contains a pre-built Python® image that you can use to run Python® applications on the Portenta X8. In this tutorial, we're going to build a container based on a provided one.
15
+
The container infrastructure provided by Arduino contains a pre-built Python® image that you can use to run Python® applications on the Portenta X8. In this tutorial, we are going to build a container based on a provided one.
16
16
17
17
While all the peripherals are accessible from the iMX8 processor running the Linux environment, it can be useful to let the onboard microcontroller take care of certain peripheral handling and exchange only the required data between the microcontroller and the Python® application.
18
18
19
-
Thus you will learn how to do that. If you haven't done so, read through the [user manual](https://docs.arduino.cc/tutorials/portenta-x8/user-manual)to understand the fundamental concepts of the X8 and the provided infrastructure.
19
+
You will be guided on how to achieve this setup. It is recommendable to familiarize yourself with the foundational elements of the Portenta X8 and its infrastructure by reading the [user manual](https://docs.arduino.cc/tutorials/portenta-x8/user-manual)if you have not already done so.
20
20
21
21
## Goals
22
22
@@ -27,9 +27,9 @@ Thus you will learn how to do that. If you haven't done so, read through the [us
- Any sensor (in this example, we'll use an [BME680](https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme680/) I<sup>2</sup>C module)
- Any sensor (in this example, we will use an [BME680](https://www.bosch-sensortec.com/products/environmental-sensors/gas-sensors/bme680/) I<sup>2</sup>C module)
33
33
-[Arduino IDE 1.8.10+](https://www.arduino.cc/en/software), [Arduino IDE 2](https://www.arduino.cc/en/software), or [Arduino Web Editor](https://create.arduino.cc/editor)
34
34
35
35
## Python® on the X8
@@ -93,7 +93,7 @@ Make sure you have installed the **Arduino Mbed OS Portenta Boards** core and up
93
93
94
94
To check if the Arduino sketch is working correctly, you may want to read the messages from the `Serial.println` statements. You cannot currently read them directly in the serial monitor of the Arduino IDE. Instead, you can use a simple service called **`py-serialrpc`**, which listens for those messages and prints them to the console.
95
95
96
-
This service needs to run on the Linux side of the X8. You can get the files [here](assets/py-serialrpc.zip). From the command prompt of your local machine, navigate to the adb tool folder and upload the files to the X8 with command:
96
+
This service needs to run on the Linux side of the X8. You can get the files [here](assets/py-serialrpc.zip). The compressed file will have every file needed to build a container as the docker compose app. From the command prompt of your local machine, navigate to the adb tool folder and upload the files to the X8 with command:
Alternatively, you could modify the files directly on the X8 using an editor such as *VIM*, so you do not need to upload the files every time. Rebuilding the container will be necessary in any case though.
202
+
Alternatively, you could modify the files directly on the X8 using an editor such as **VIM**, so you do not need to upload the files every time. Rebuilding the container will be necessary in any case though.
203
203
204
-
If you wonder how to specify the Python® script that is executed when running a container, have a look at the `Dockerfile` file. There you will find the `ENTRYPOINT`command that takes multiple arguments. In our example: `ENTRYPOINT [ "python3", "m4_to_python.py"]`.
204
+
If you wonder how to specify the Python® script that is executed when running a container, have a look at the `Dockerfile` file. There you will find the `ENTRYPOINT`command that takes multiple arguments. In our example:
205
+
206
+
```python
207
+
ENTRYPOINT [ "python3", "m4_to_python.py"]`
208
+
```
205
209
206
210
## Conclusion
207
211
208
212
In this tutorial, you learned how to use the docker infrastructure to build a container that runs a Python® application. You have also learned how to use the RPC mechanism to exchange data between the microcontroller and the iMX8, which runs the Linux operating system.
209
213
210
214
### Next Steps
211
215
212
-
- You may now further process the data that you receive from the Arduino sketch and e.g. upload it to a Cloud service or similar.
216
+
- You may further process the data you receive from the Arduino sketch and, e.g., upload it to a Cloud service or similar.
213
217
- Familiarize yourself with Docker commands to adjust the docker configuration to your needs.
Copy file name to clipboardExpand all lines: content/hardware/04.pro/boards/portenta-x8/tutorials/05.docker-container/content.md
+28-14Lines changed: 28 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,11 @@ hardware:
16
16
17
17
## Overview
18
18
19
-
[Docker](http://docker.com) is a platform full of applications, called containers. Containers are isolated solutions, thus they don't have to depend on your environment. Making them portable and consistent throughout development, testing, and production.
19
+
[Docker](http://docker.com) is a platform full of applications called containers. Containers are isolated solutions; thus, they do not have to depend on your environment, making them portable and consistent throughout development, testing, and production.
20
20
21
21
You can download, install, use, and share applications in the form of containers. You can find all the available container images on the [hub.docker.com](https://hub.docker.com) page.
22
22
23
-
In this tutorial, we will go through the steps of how to install, run and remove Docker's official [Hello-World image](https://hub.docker.com/_/hello-world)
23
+
In this tutorial, we will go through the steps of how to install, run, and remove Docker's official [Hello-World image](https://hub.docker.com/_/hello-world).
24
24
25
25
## Goals
26
26
@@ -31,7 +31,7 @@ In this tutorial, we will go through the steps of how to install, run and remove
- USB-C® cable (either USB-C® to USB-A or USB-C® to USB-C®)
36
36
- Wi-Fi® Access Point with Internet Access
37
37
- ADB: [Check how to connect to your Portenta X8](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience)
@@ -41,17 +41,23 @@ In this tutorial, we will go through the steps of how to install, run and remove
41
41
42
42
## Using Docker
43
43
44
-
The Portenta X8 provides Docker CLI by default. The following command will help you verify if it is installed correctly:
44
+
The Portenta X8 provides Docker CLI by default. To verify its correct installation, use the following command:
45
45
46
46
```bash
47
47
docker -v
48
48
```
49
49
50
+
Or as well:
51
+
52
+
```bash
53
+
docker --version
54
+
```
55
+
50
56
***To use this tool, you will need to connect to your device first. Check [how to connect using adb/ssh](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#out-of-the-box-experience).***
51
57
52
-
You can check Docker's reference documentation, which covers all the features of the tool in depth at [docs.docker.com](https://docs.docker.com/).
58
+
You can explore Docker's comprehensive reference documentation, covering all tool features in depth, at [docs.docker.com](https://docs.docker.com/).
53
59
54
-
The following steps will show how to install, run and uninstall the "Hello World"container.
60
+
The following steps will show how to pull the **"Hello World"** image from Docker Hub, run the container, and view its status.
55
61
56
62
To avoid a lack of permissions while launching ```adb shell```, you may type the following: ```newgrp - docker```.
57
63
@@ -61,7 +67,7 @@ The previous command and other important info about Linux on your Portenta are d
61
67
62
68
First, you will need to search for ["Hello World" container image](https://hub.docker.com/_/hello-world). The container image can be found within the Docker hub, where you will be able to find a variety of readily-available container images. It will be used to verify docker is working as intended with the Portenta X8.
63
69
64
-
The following command must be used to pull the `hello-world` image. The Docker hub page for images has the instructions to pull the image and deploy the container.
70
+
The following command is used to pull the `hello-world` image. The Docker hub page for images has the instructions to pull the image and deploy the container.
65
71
66
72
```bash
67
73
docker pull hello-world
@@ -71,17 +77,17 @@ docker pull hello-world
71
77
72
78
### Run The Installed Container
73
79
74
-
This is the command to begin the container instance.
80
+
Use this command to begin a container from the `hello-world` image:
75
81
76
82
```bash
77
83
docker run hello-world
78
84
```
79
85
80
86

81
87
82
-
***To be able to see an active container with `docker ps -a`, you will need to run it at least once with `docker run`***
88
+
***To see a list of active and exited containers, `docker ps -a` should be used after running a container at least once with `docker run`***
83
89
84
-
### Listing The Installed Packages
90
+
### Listing Active Containers And Available Docker Images
85
91
86
92
The following command will display the active containers and will show the `hello-world` container if it was able to run successfully. The `STATUS` message will let you know if the container is active or has finished operation depending on its purpose.
87
93
@@ -99,17 +105,25 @@ docker images
99
105
100
106

101
107
102
-
### How to Uninstall A Container
108
+
### How to Remove A Container
109
+
110
+
You will need to obtain an assigned `CONTAINER ID` to remove a container of your choice. This can be found by listing all containers, including inactive ones:
103
111
104
-
You will need to obtain an assigned `CONTAINER ID` to be able to remove a container of your choice. The list of active containers provides this information. The remove (`rm`) command is then used with the desired container identifier to proceed with the removal process.
112
+
```bash
113
+
docker ps -a
114
+
```
115
+
116
+
The remove (`rm`) command is then used with the desired container identifier to proceed with the removal process.
105
117
106
118
```bash
107
119
docker container rm <CONTAINER ID>
108
120
```
109
121
110
-
For this example, the command `docker ps -a` will show the `CONTAINER ID` of the `hello-world` container designated as: `c44ba77b65cb`. If you encounter an error stating that the container cannot be removed, it may mean that the container has an actively ongoing operation which can be checked with `STATUS` message.
122
+
For this example, the command `docker ps -a` will show the `CONTAINER ID` of the `hello-world` container designated as: **`c44ba77b65cb`**.
123
+
124
+
If you encounter an error stating that the container cannot be removed, it may mean that the container has an ongoing operation that can be checked with a `STATUS` message.
111
125
112
-
Granted that this is the case, you will need to stop the container and verify with `STATUS` message that it has exited successfully. To do this, the following command is used:
126
+
If this is the case, you will need to stop the container and verify with a`STATUS` message that it has exited successfully. To do this, the following command is used:
0 commit comments