Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 86ef379

Browse files
marqdevxsebromero
andauthored
Referenced library wrapper (#72)
* 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]>
1 parent 08e76cb commit 86ef379

File tree

6 files changed

+25
-14
lines changed

6 files changed

+25
-14
lines changed

content/tutorials/portenta-h7/por-ard-ap/content.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ Begin by plugging in your Portenta board to your computer using a USB-C cable an
3333
![The Portenta H7 can be connected to the computer using an appropriate USB-C cable](assets/por_tut1_im1.png)
3434

3535
## 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**
3739

3840
```cpp
3941
#include <WiFi.h>

content/tutorials/portenta-h7/por-ard-ble/content.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ You will need to install the ArduinoBLE library in the Arduino IDE you are using
3939

4040
## 3. Create the BLE Sketch
4141

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**
4343

4444
```cpp
4545
#include <ArduinoBLE.h>
@@ -178,4 +178,3 @@ If you try to upload a sketch and receive an error message, saying that the uplo
178178
**Authors:** Jeremy Ellis, Lenard George, Sebastian Romero
179179
**Reviewed by:** Lenard George, Sebastian Romero, José Garcia [02.09.2020]
180180
**Last revision:** Sebastian Romero [16.09.2020]
181-

content/tutorials/portenta-h7/por-ard-dcp/content.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Processor cores are individual processing units within the board's main processi
1818
![The Architectures of Cortex® M7 and M4 cores.](assets/por_ard_dcp_m4_m7_architectures.svg?sanitize=true)
1919

2020
# 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.
2222

2323
![Running two different sketch files on the different cores.](assets/por_ard_dcp_tutorial_overview.svg?sanitize=true)
2424

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

2828
![A Basic setup of the board attached to your computer](../por-ard-gs/assets/por_ard_gs_basic_setup.svg?sanitize=true)
2929

30+
**Note:** You can access the examples from the tutorials library once it's installed: **Examples -> Arduino_Pro_Tutorials -> Dual Core Processing**
31+
3032
## 2. Setting the LED Color
3133
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. 
3234

3335
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.
3436

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.
3638

3739
```cpp
3840
// the setup function runs once when you press reset or power the board
@@ -51,12 +53,12 @@ void loop() {
5153
```
5254

5355
## 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.
5557

56-
![Uploading the blink_RedLed_m7 sketch to the M7 core](assets/por_ard_dcp_upload_code_m7.png)
58+
![Uploading the BlinkRedLed_M7 sketch to the M7 core](assets/por_ard_dcp_upload_code_m7.png)
5759

5860
## 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.
6062

6163
```cpp
6264
// 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
8183

8284
![The M7 and the M4 cores share the flash memory where the sketches are stored.](assets/por_ard_dcp_m4_m7_flash_memory.svg?sanitize=true)
8385

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.
8587

8688
```cpp
8789
// the setup function runs once when you press reset or power the board
@@ -103,9 +105,9 @@ void loop() {
103105
Once this sketch runs on the M7 core, it boots the M4 core and allows it to run its corresponding sketch.
104106

105107
## 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.
107109

108-
![Uploading the blink_GreenLed_M4 to the M4 core](assets/por_ard_dcp_upload_code_m4.png)
110+
![Uploading the BlinkGreenLed_M4 to the M4 core](assets/por_ard_dcp_upload_code_m4.png)
109111

110112
# Programming both Cores with just one sketch
111113
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
115117
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.
116118

117119
## 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.
119121

120122
```cpp
121123
int myLED;

content/tutorials/portenta-h7/por-ard-gs/content.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ Now it's time to upload the sketch and see if the LED will start to blink. Make
8585

8686
![Selecting the Arduino Portenta H7 (M7 core)](assets/por_gs_board_selection_pro_ide.png)
8787

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
8991
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.
9092

9193
# Next Steps

content/tutorials/portenta-h7/por-ard-kvs/content.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ Let's program the Portenta with a sketch. We will also define a few helper funct
2626
* Create a new sketch named `FlashKeyValue.ino`
2727
* Create a new file named `FlashIAPLimits.h` to store the helper functions in a reusable file.
2828

29+
**Note:** Finished sketch its inside the tutorials library wrapper at:
30+
**Examples -> Arduino_Pro_Tutorials -> Creating a Flash-Optimised Key-Value Store -> FlashKeyValueStore**
31+
2932
## 3. Populate the Helper Functions
3033
First let's add the helper functions to the `FlashIAPLimits.h` header. This will determine the available Flash limits to allocate the custom data.
3134

@@ -283,4 +286,4 @@ It's not recommended to use the flash of the microcontroller as the primary stor
283286

284287
**Authors:** Giampaolo Mancini
285288
**Reviewed by:** Pablo Marquínez [2.12.2020]
286-
**Last revision:** Sebastian Romero [11.1.2021]
289+
**Last revision:** Sebastian Romero [11.1.2021]

content/tutorials/portenta-h7/por-ard-usb/content.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Then, open: File>Examples>USBHOST>KeyboardController
6767

6868
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.
6969

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+
7073
## 3. Detecting the Keys From the Keyboard
7174

7275
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

Comments
 (0)