Skip to content

Provisioning binary 0.2.x #548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
24 changes: 24 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ jobs:
- name: ArduinoECCX08
- name: Arduino_Cellular
- name: Blues Wireless Notecard
- name: ArduinoBLE
- name: Arduino_KVStore
- name: Arduino_NetworkConfigurator
sketch-paths: |
- examples/ArduinoIoTCloud-NetConfig
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/ArduinoIoTCloud-Schedule
Expand All @@ -207,7 +211,11 @@ jobs:
- name: arduino:mbed_nicla
libraries: |
- name: Blues Wireless Notecard
- name: ArduinoBLE
- name: Arduino_KVStore
- name: Arduino_NetworkConfigurator
sketch-paths: |
- examples/ArduinoIoTCloud-NetConfig
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/ArduinoIoTCloud-Schedule
Expand All @@ -222,7 +230,11 @@ jobs:
- name: ArduinoBearSSL
- name: ArduinoECCX08
- name: Blues Wireless Notecard
- name: ArduinoBLE
- name: Arduino_KVStore
- name: Arduino_NetworkConfigurator
sketch-paths: |
- examples/ArduinoIoTCloud-NetConfig
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/ArduinoIoTCloud-Schedule
Expand All @@ -237,7 +249,11 @@ jobs:
- name: ArduinoBearSSL
- name: ArduinoECCX08
- name: Blues Wireless Notecard
- name: ArduinoBLE
- name: Arduino_KVStore
- name: Arduino_NetworkConfigurator
sketch-paths: |
- examples/ArduinoIoTCloud-NetConfig
- examples/ArduinoIoTCloud-DeferredOTA
- examples/ArduinoIoTCloud-Notecard
- examples/ArduinoIoTCloud-Schedule
Expand All @@ -251,7 +267,11 @@ jobs:
libraries: |
- name: Arduino_Cellular
- name: Blues Wireless Notecard
- name: ArduinoBLE
- name: Arduino_KVStore
- name: Arduino_NetworkConfigurator
sketch-paths: |
- examples/ArduinoIoTCloud-NetConfig
- examples/ArduinoIoTCloud-Notecard
- examples/ArduinoIoTCloud-Schedule
- examples/utility/Provisioning
Expand All @@ -263,7 +283,11 @@ jobs:
- name: arduino:renesas_uno
libraries: |
- name: Blues Wireless Notecard
- name: ArduinoBLE
- name: Arduino_KVStore
- name: Arduino_NetworkConfigurator
sketch-paths: |
- examples/ArduinoIoTCloud-NetConfig
- examples/ArduinoIoTCloud-Notecard
- examples/ArduinoIoTCloud-Schedule
# Nano ESP32
Expand Down
239 changes: 239 additions & 0 deletions .github/workflows/compile-provisioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
name: Compile Provisioning

on:
pull_request:
paths:
- ".github/workflows/compile-provisioning.yml"
- "examples/**"
- "src/**"
push:
paths:
- ".github/workflows/compile-provisioning.yml"
- "examples/**"
- "src/**"

jobs:
build:
runs-on: ubuntu-latest

env:
# libraries to install for all boards
UNIVERSAL_LIBRARIES: |
# Install the ArduinoIoTCloud library from the repository
- source-path: ./
- name: ArduinoBLE
version: 1.4.0
- name: ArduinoHttpClient
version: 0.6.1
- name: Arduino_DebugUtils
version: 1.4.0
- name: ArduinoMqttClient
version: 0.1.8
- name: Arduino_KVStore
version: 1.0.0
- source-url: https://github.com/arduino-libraries/Arduino_ConnectionHandler.git
version: 1.1.1
- source-url: https://github.com/arduino-libraries/Arduino_SecureElement.git
version: 0.4.0
- source-url: https://github.com/arduino-libraries/Arduino_CloudUtils.git
version: 1.1.0
- source-url: https://github.com/arduino-libraries/Arduino_UniqueHWId.git
version: 7e1bfeb586cac00f043c39997a1e9937ed8152b0
- source-url: https://github.com/arduino-libraries/Arduino_NetworkConfigurator.git
version: 0.1.3
# sketch paths to compile (recursive) for all boards
UNIVERSAL_SKETCH_PATHS: |
- examples/utility/Provisioning_2.0
SKETCHES_REPORTS_PATH: sketches-reports

strategy:
fail-fast: false

matrix:
board:
- fqbn: arduino:samd:mkrwifi1010
type: nina
artifact-name-suffix: arduino-samd-mkrwifi1010
- fqbn: arduino:samd:nano_33_iot
type: nina
artifact-name-suffix: arduino-samd-nano_33_iot
- fqbn: arduino:mbed_portenta:envie_m7:split=100_0
type: mbed_portenta
artifact-name-suffix: arduino-mbed_portenta-envie_m7
- fqbn: arduino:mbed_nano:nanorp2040connect
type: nina
artifact-name-suffix: arduino-mbed_nano-nanorp2040connect
- fqbn: arduino:mbed_nicla:nicla_vision
type: mbed_nicla
artifact-name-suffix: arduino-mbed_nicla-nicla_vision
- fqbn: arduino:mbed_opta:opta
type: mbed_opta
artifact-name-suffix: arduino-mbed_opta-opta
- fqbn: arduino:mbed_giga:giga
type: mbed_giga
artifact-name-suffix: arduino-mbed_giga-giga
- fqbn: arduino:renesas_portenta:portenta_c33
type: renesas_portenta
artifact-name-suffix: arduino-renesas_portenta-portenta_c33
- fqbn: arduino:renesas_uno:unor4wifi
type: renesas_uno
artifact-name-suffix: arduino-renesas_uno-unor4wifi

# make board type-specific customizations to the matrix jobs
include:
# MKR WiFi 1010, Nano 33 IoT, Nano RP2040 Connect
- board:
type: nina
platforms: |
# Install samd and mbed_nano platform via Boards Manager
- name: arduino:samd
version: 1.8.14
- name: arduino:mbed_nano
version: 4.2.4
libraries: |
- name: RTCZero
version: 1.6.0
- name: ArduinoECCX08
version: 1.3.8
- name: Adafruit SleepyDog Library
version: 1.6.5
- source-url: https://github.com/arduino-libraries/ArduinoBearSSL.git
version: 1.7.6
- source-url: https://github.com/arduino-libraries/WiFiNINA.git
version: 69e786c5c73fe94b7f408853550f6f151cfc58b0
# Portenta
- board:
type: mbed_portenta
platforms: |
# Install mbed_portenta platform via Boards Manager
- name: arduino:mbed_portenta
version: 4.2.4
libraries: |
- name: Arduino_Cellular
version: 1.2.1
- name: ArduinoECCX08
version: 1.3.8
- source-url: https://github.com/arduino-libraries/ArduinoBearSSL.git
version: 1.7.6
# Nicla Vision
- board:
type: mbed_nicla
platforms: |
# Install mbed_nicla platform via Boards Manager
- name: arduino:mbed_nicla
version: 4.2.4
# Opta
- board:
type: mbed_opta
platforms: |
# Install mbed_opta platform via Boards Manager
- name: arduino:mbed_opta
version: 4.2.4
libraries: |
- name: ArduinoECCX08
version: 1.3.8
- source-url: https://github.com/arduino-libraries/ArduinoBearSSL.git
version: 1.7.6
# GIGA
- board:
type: mbed_giga
platforms: |
# Install mbed_giga platform via Boards Manager
- name: arduino:mbed_giga
version: 4.2.4
libraries: |
- name: ArduinoECCX08
version: 1.3.8
- source-url: https://github.com/arduino-libraries/ArduinoBearSSL.git
version: 1.7.6
# Portenta C33
- board:
type: renesas_portenta
platforms: |
# Install renesas_portenta platform via Boards Manager
- name: arduino:renesas_portenta
version: 1.4.1
libraries: |
- name: Arduino_Cellular
version: 1.2.1
# UNO R4 WiFi
- board:
type: renesas_uno
platforms: |
# Install renesas_uno platform via Boards Manager
- name: arduino:renesas_uno
version: 1.4.1

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Compile production provisioning sketch
uses: arduino/compile-sketches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
platforms: ${{ matrix.platforms }}
fqbn: ${{ matrix.board.fqbn }}
libraries: |
${{ env.UNIVERSAL_LIBRARIES }}
${{ matrix.libraries }}
sketch-paths: |
${{ env.UNIVERSAL_SKETCH_PATHS }}
${{ matrix.sketch-paths }}
enable-deltas-report: "true"
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
cli-compile-flags: |
- --verbose
- --output-dir
- ${{ runner.temp }}/provisioning-prod

- name: Compile staging provisioning sketch
uses: arduino/compile-sketches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
platforms: ${{ matrix.platforms }}
fqbn: ${{ matrix.board.fqbn }}
libraries: |
${{ env.UNIVERSAL_LIBRARIES }}
${{ matrix.libraries }}
sketch-paths: |
${{ env.UNIVERSAL_SKETCH_PATHS }}
${{ matrix.sketch-paths }}
enable-deltas-report: "true"
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
cli-compile-flags: |
- --verbose
- --build-property
- "build.extra_flags=-DCOMPILE_TEST=1"
- --output-dir
- ${{ runner.temp }}/provisioning-staging

- name: Write data to size trends report spreadsheet
# Update report on every push to the master branch
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: arduino/report-size-trends@main
with:
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
google-key-file: ${{ secrets.GOOGLE_KEY_FILE }}
spreadsheet-id: 1I6NZkpZpf8KugBkE92adB1Z3_b7ZepOpCdYTOigJpN4

- name: Save memory usage change report as artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: sketches-report-${{ matrix.board.artifact-name-suffix }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Save production artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: provisioning-prod-${{ matrix.board.artifact-name-suffix }}
path: ${{ runner.temp }}/provisioning-prod/

- name: Save staging artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: provisioning-staging-${{ matrix.board.artifact-name-suffix }}
path: ${{ runner.temp }}/provisioning-staging/
62 changes: 62 additions & 0 deletions examples/ArduinoIoTCloud-NetConfig/ArduinoIoTCloud-NetConfig.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
This sketch demonstrates how to exchange data between your board and the Arduino IoT Cloud.

* Connect a potentiometer (or other analog sensor) to A0.
* When the potentiometer (or sensor) value changes the data is sent to the Cloud.
* When you flip the switch in the Cloud dashboard the onboard LED lights gets turned ON or OFF.

IMPORTANT:
This sketch works with WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
On a LoRa board, if it is configured as a class A device (default and preferred option),
values from Cloud dashboard are received only after a value is sent to Cloud.

The full list of compatible boards can be found here:
- https://github.com/arduino-libraries/ArduinoIoTCloud#what
*/

#include "thingProperties.h"

#if !defined(LED_BUILTIN) && !defined(ARDUINO_NANO_ESP32)
static int const LED_BUILTIN = 2;
#endif

void setup() {
/* Initialize serial and wait up to 5 seconds for port to open */
Serial.begin(9600);
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { }

/* Set the debug message level:
* - DBG_ERROR: Only show error messages
* - DBG_WARNING: Show warning and error messages
* - DBG_INFO: Show info, warning, and error messages
* - DBG_DEBUG: Show debug, info, warning, and error messages
* - DBG_VERBOSE: Show all messages
*/
setDebugMessageLevel(DBG_INFO);

/* Configure LED pin as an output */
pinMode(LED_BUILTIN, OUTPUT);

/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
initProperties();

/* Initialize Arduino IoT Cloud library */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

ArduinoCloud.printDebugInfo();
}

void loop() {
ArduinoCloud.update();
potentiometer = analogRead(A0);
seconds = millis() / 1000;
}

/*
* 'onLedChange' is called when the "led" property of your Thing changes
*/
void onLedChange() {
Serial.print("LED set to ");
Serial.println(led);
digitalWrite(LED_BUILTIN, led);
}
Loading
Loading