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
{{ message }}
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
* Create content.md
* Reference wrapper, changed name of the sketches
* Added Reference to the library wrapper
* Algined names of the sketches with the ones in the Library wrapper
* Reference library wrapper
* Reference library wrapper
* Reference Tutorials wrapper
* Reference library wrapper
* Update content/tutorials/portenta-h7/por-ard-gs/content.md
Co-authored-by: Sebastian Romero <[email protected]>
* Apply suggestions from code review
* Apply suggestions from code review
Co-authored-by: Sebastian Romero <[email protected]>
Copy file name to clipboardExpand all lines: content/tutorials/portenta-h7/por-ard-ap/content.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,9 @@ Begin by plugging in your Portenta board to your computer using a USB-C cable an
33
33

34
34
35
35
## 2. Create the Web Server Sketch
36
-
Next we need to create a web server sketch that will handle the HTTP GET requests and provide the client devices with the HTML web page. The [Wifi.h](https://www.arduino.cc/en/Reference/WiFi) library provides all necessary methods that allows Arduino boards to use their WiFi features provided by the on-board WiFi module. To set up the web server copy the following code, paste it into a new sketch file and name it **simpleWebServer.ino**.
36
+
Next we need to create a web server sketch that will handle the HTTP GET requests and provide the client devices with the HTML web page. The [Wifi.h](https://www.arduino.cc/en/Reference/WiFi) library provides all necessary methods that allows Arduino boards to use their WiFi features provided by the on-board WiFi module. To set up the web server copy the following code, paste it into a new sketch file and name it **SimpleWebServer.ino**.
37
+
38
+
**Note:** You can access the final sketch inside the library: **Examples -> Arduino_Pro_Tutorials -> Portenta H7 as a WiFi Access Point -> SimpleWebServer**
Copy file name to clipboardExpand all lines: content/tutorials/portenta-h7/por-ard-ble/content.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ You will need to install the ArduinoBLE library in the Arduino IDE you are using
39
39
40
40
## 3. Create the BLE Sketch
41
41
42
-
Let's program the Portenta with the following example sketch. If the BLE module can be initialized correctly, you will see the blue LED lighting up for one second after uploading the sketch. If it fails you will see the red LED lighting up instead. Copy and paste the following code into a new sketch in your IDE.
42
+
Let's program the Portenta with the following example sketch. If the BLE module can be initialized correctly, you will see the blue LED lighting up for one second after uploading the sketch. If it fails you will see the red LED lighting up instead. Copy and paste the following code into a new sketch in your IDE or by open it from: **Examples -> Arduino_Pro_Examples -> BLE Connectivity on Portenta H7 -> PortentaBLE**
43
43
44
44
```cpp
45
45
#include<ArduinoBLE.h>
@@ -178,4 +178,3 @@ If you try to upload a sketch and receive an error message, saying that the uplo
178
178
**Authors:** Jeremy Ellis, Lenard George, Sebastian Romero
179
179
**Reviewed by:** Lenard George, Sebastian Romero, José Garcia [02.09.2020]
Copy file name to clipboardExpand all lines: content/tutorials/portenta-h7/por-ard-dcp/content.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Processor cores are individual processing units within the board's main processi
18
18

19
19
20
20
# Accessing the M7 and M4 Core
21
-
To best illustrate the idea of dual core processing, you will be running two separate sketch files. One on each of the cores which blinks the RGB LED in a different colour. The **blink_RedLed_m7.ino** sketch will set the built-in RGB LED on the board to red and blink it with a delay of 500 ms. The **blink_GreenLed_M4.ino** sketch will access the green LED in the RGB led and blink it with a delay of 200 ms. Both the cores will be executing the corresponding sketch file simultaneously and as a result both the green and red LED blink, however, at different intervals.
21
+
To best illustrate the idea of dual core processing, you will be running two separate sketch files. One on each of the cores which blinks the RGB LED in a different colour. The **BlinkRedLed_M7.ino** sketch will set the built-in RGB LED on the board to red and blink it with a delay of 500 ms. The **BlinkGreenLed_M4.ino** sketch will access the green LED in the RGB led and blink it with a delay of 200 ms. Both the cores will be executing the corresponding sketch file simultaneously and as a result both the green and red LED blink, however, at different intervals.
22
22
23
23

24
24
@@ -27,12 +27,14 @@ Begin by plugging-in your Portenta board to your computer using an appropriate U
27
27
28
28

29
29
30
+
**Note:** You can access the examples from the tutorials library once it's installed: **Examples -> Arduino_Pro_Tutorials -> Dual Core Processing**
31
+
30
32
## 2. Setting the LED Color
31
33
In the previous tutorial you learned how to access the built-in RGB LED through the macro definition LED_BUILTIN. You can also control the distinct Red, Green and Blue LED separately through the LEDR, LEDG and LEDB macro definition respectively.
32
34
33
35
Please note that, opposed to other Arduino boards, on the Portenta H7 the built-in RGB led pins need to be pulled to ground to make the LED light up. This means that a voltage level of LOW will turn the LED on, a voltage level of HIGH will turn it off.
34
36
35
-
The following sketch blinks the red LED at an interval of 200ms controlled by the M7 core.Save your sketch as **blink_RedLed_m7** and compile your sketch file.
37
+
The following sketch blinks the red LED at an interval of 200ms controlled by the M7 core.Save your sketch as **BlinkRedLed_M7** and compile your sketch file.
36
38
37
39
```cpp
38
40
// the setup function runs once when you press reset or power the board
@@ -51,12 +53,12 @@ void loop() {
51
53
```
52
54
53
55
## 3. Upload the Sketch to the M7 Core
54
-
Select the **Arduino Portenta H7 (M7 core)** from the **Board** menu and the port the Portenta is connected to (e.g. /dev/cu.usbmodem141101). Upload the **blink_RedLed_m7.ino** sketch. Doing so will automatically compile the sketch beforehand. When the sketch is uploaded the RGB LED on the board will start blinking red.
56
+
Select the **Arduino Portenta H7 (M7 core)** from the **Board** menu and the port the Portenta is connected to (e.g. /dev/cu.usbmodem141101). Upload the **BlinkRedLed_M7.ino** sketch. Doing so will automatically compile the sketch beforehand. When the sketch is uploaded the RGB LED on the board will start blinking red.
55
57
56
-

58
+

57
59
58
60
## 4. Making the LED Blink Green
59
-
Let's write another sketch that makes the RGB LED on the board blink green. Open a new sketch file and call it **blink_GreenLed_M4.ino**. Copy and paste the following program that blinks the LED green, denoted by the variable `LEDG`, with a delay of 500ms. This time the blinking is controlled by the M4 core.
61
+
Let's write another sketch that makes the RGB LED on the board blink green. Open a new sketch file and call it **BlinkGreenLed_M4.ino**. Copy and paste the following program that blinks the LED green, denoted by the variable `LEDG`, with a delay of 500ms. This time the blinking is controlled by the M4 core.
60
62
61
63
```cpp
62
64
// the setup function runs once when you press reset or power the board
@@ -81,7 +83,7 @@ The bootloader of the H7 boards is configured in such a way that only M7 gets bo
81
83
82
84

83
85
84
-
Before you can upload the code for the M4 core to the flash memory you need to add the `bootM4()` command in the **blink_RedLed_m7.ino** sketch file that is uploaded and run by the M7 core. Copy and paste the following command `bootM4()` inside the `setup()` function of the **blink_RedLed_m7.ino** sketch and upload the sketch to M7 once again.
86
+
Before you can upload the code for the M4 core to the flash memory you need to add the `bootM4()` command in the **BlinkRedLed_M7.ino** sketch file that is uploaded and run by the M7 core. Copy and paste the following command `bootM4()` inside the `setup()` function of the **BlinkRedLed_M7.ino** sketch and upload the sketch to M7 once again.
85
87
86
88
```cpp
87
89
// the setup function runs once when you press reset or power the board
@@ -103,9 +105,9 @@ void loop() {
103
105
Once this sketch runs on the M7 core, it boots the M4 core and allows it to run its corresponding sketch.
104
106
105
107
## 6. Uploading to the M4 Core
106
-
The final step is to upload the sketch that we prepared for the M4. Now open **Tools> Boards** from the IDE menu and select **Arduino Portenta H7 (M4 core)** from the boards. Upload the **blink_GreenLed_M4.ino** to the board. Note that there is no separate serial port listed for the M4 in the port menu as the M7 takes care of the serial communication. The RGB LED blinking in RED currently, starts blinking in green simultaneously at an interval of 500 ms. When the blinking overlaps the mix of red and green light is perceived as yellow.
108
+
The final step is to upload the sketch that we prepared for the M4. Now open **Tools> Boards** from the IDE menu and select **Arduino Portenta H7 (M4 core)** from the boards. Upload the **BlinkGreenLed_M4.ino** to the board. Note that there is no separate serial port listed for the M4 in the port menu as the M7 takes care of the serial communication. The RGB LED blinking in RED currently, starts blinking in green simultaneously at an interval of 500 ms. When the blinking overlaps the mix of red and green light is perceived as yellow.
107
109
108
-

110
+

109
111
110
112
# Programming both Cores with just one sketch
111
113
So far, we used separate sketch files to program the different cores. We can also combine these two sketch files into one by taking advantage the preprocessor directives '#ifdef'. This way you can program different behaviors for both cores by using the same program.
@@ -115,7 +117,7 @@ So far, we used separate sketch files to program the different cores. We can als
115
117
Let's now to create a new sketch to blink both of LEDs with random sequences, this will allow you to clearly see different behaviors for both of the LEDs using a very simple program.
116
118
117
119
## 1. Programming the M7 Core Set-up
118
-
Let's start by opening a new sketch and naming it **blink_2cores.ino**. Then let's add the following lines of code.
120
+
Let's start by opening a new sketch and naming it **BlinkBothCores.ino**. Then let's add the following lines of code.
Copy file name to clipboardExpand all lines: content/tutorials/portenta-h7/por-ard-gs/content.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,9 @@ Now it's time to upload the sketch and see if the LED will start to blink. Make
85
85
86
86

87
87
88
-
# Conclusion
88
+
**Optional:** We collect all the sketches from the tutorials in a library which you can install from the Library Manager: **Tools -> Manage Libraries**. Search for 'Arduino_Pro_Tutorials' or download them from the [repository](https://github.com/arduino-libraries/Arduino_Pro_Tutorials/releases).
89
+
90
+
# Conclusion
89
91
You have now configured your Portenta board to run Arduino sketches. Along with that you gained an understanding of how the Arduino Core runs on top of Mbed OS.
The **USBHost** library that is used in this example is a revamp of the classic Arduino **USBHost** library. This new version, among adapting the protocol to the newer USB version, allows to connect devices through USB Hubs (USB adapters). For a better understanding about how the USBHost library works, it could be helpful for you to take a look at the Arduino [USBHost](https://www.arduino.cc/en/Reference/USBHost) library.
69
69
70
+
**Note:** You can find the finished sketch in the examples of the Arduino_Pro_Tutorials library:
71
+
**Examples -> Arduino_Pro_Tutorials -> Portenta H7 as a USB Host -> LEDKeyboardController**
72
+
70
73
## 3. Detecting the Keys From the Keyboard
71
74
72
75
The example you opened describes how the board will handle the connection with a keyboard, addressing the functionality of each one of the keys of it. In order to detect which one of the keys from the keyboard is pressed, you will need to modify and add some lines of code to the example.
0 commit comments