From a6a14486ccef599dc4e3761e7bf915ccf87dd818 Mon Sep 17 00:00:00 2001 From: "Zachary J. Fields" Date: Thu, 7 Sep 2023 11:56:23 -0500 Subject: [PATCH 1/3] chore: refactor binary examples --- .../Example0_LibrarylessCommunication.ino | 2 +- examples/Example1_NotecardBasics/Example1_NotecardBasics.ino | 2 +- .../Example2_PeriodicCommunications.ino | 2 +- examples/Example5_UsingTemplates/Example5_UsingTemplates.ino | 2 +- examples/Example6_SensorTutorial/Example6_SensorTutorial.ino | 2 +- examples/Example7_PowerControl/Example7_PowerControl.ino | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino b/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino index e442280..f93da6e 100644 --- a/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino +++ b/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino @@ -90,7 +90,7 @@ void loop() static unsigned eventCounter = 0; if (++eventCounter > 25) { - txRxPinsSerial.println("Demo cycle complete. Program stopped. Press RESET to restart."); + txRxPinsSerial.println("Demo cycle complete. Program stopped. Press RESET to restart.\n"); delay(10000); // 10 seconds return; } diff --git a/examples/Example1_NotecardBasics/Example1_NotecardBasics.ino b/examples/Example1_NotecardBasics/Example1_NotecardBasics.ino index 3ffdd39..65fb804 100644 --- a/examples/Example1_NotecardBasics/Example1_NotecardBasics.ino +++ b/examples/Example1_NotecardBasics/Example1_NotecardBasics.ino @@ -127,7 +127,7 @@ void loop() static unsigned eventCounter = 0; if (++eventCounter > 25) { - notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart."); + notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart.\n"); delay(10000); // 10 seconds return; } diff --git a/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino b/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino index e57223b..acdad47 100644 --- a/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino +++ b/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino @@ -173,7 +173,7 @@ void loop() static unsigned eventCounter = 0; if (++eventCounter > 25) { - notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart."); + notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart.\n"); delay(10000); // 10 seconds return; } diff --git a/examples/Example5_UsingTemplates/Example5_UsingTemplates.ino b/examples/Example5_UsingTemplates/Example5_UsingTemplates.ino index 66f9f4a..575969d 100644 --- a/examples/Example5_UsingTemplates/Example5_UsingTemplates.ino +++ b/examples/Example5_UsingTemplates/Example5_UsingTemplates.ino @@ -155,7 +155,7 @@ void loop() static unsigned eventCounter = 0; if (++eventCounter > 25) { - notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart."); + notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart.\n"); delay(10000); // 10 seconds return; } diff --git a/examples/Example6_SensorTutorial/Example6_SensorTutorial.ino b/examples/Example6_SensorTutorial/Example6_SensorTutorial.ino index 5b7c903..202dd58 100644 --- a/examples/Example6_SensorTutorial/Example6_SensorTutorial.ino +++ b/examples/Example6_SensorTutorial/Example6_SensorTutorial.ino @@ -66,7 +66,7 @@ void loop() static unsigned eventCounter = 0; if (++eventCounter > 25) { - notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart."); + notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart.\n"); delay(10000); // 10 seconds return; } diff --git a/examples/Example7_PowerControl/Example7_PowerControl.ino b/examples/Example7_PowerControl/Example7_PowerControl.ino index 54e084f..743f01e 100644 --- a/examples/Example7_PowerControl/Example7_PowerControl.ino +++ b/examples/Example7_PowerControl/Example7_PowerControl.ino @@ -134,7 +134,7 @@ void loop() // Bump the number of cycles if (++globalState.cycles > 25) { - notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart."); + notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart.\n"); delay(10000); // 10 seconds return; } From b48eec467d7e513fb97169bceb3f8feb54972960 Mon Sep 17 00:00:00 2001 From: "Zachary J. Fields" Date: Thu, 14 Sep 2023 14:28:23 -0500 Subject: [PATCH 2/3] fix: loop termination behavior --- .../Example0_LibrarylessCommunication.ino | 1 - .../Example2_PeriodicCommunications.ino | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino b/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino index f93da6e..262f875 100644 --- a/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino +++ b/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino @@ -90,7 +90,6 @@ void loop() static unsigned eventCounter = 0; if (++eventCounter > 25) { - txRxPinsSerial.println("Demo cycle complete. Program stopped. Press RESET to restart.\n"); delay(10000); // 10 seconds return; } diff --git a/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino b/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino index acdad47..8cef03f 100644 --- a/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino +++ b/examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino @@ -168,16 +168,6 @@ void loop() notecard.logDebug("performing sensor measurement\n"); lastStatusMs = millis(); - // Count the simulated measurements that we send to the cloud, and stop the - // demo before long. - static unsigned eventCounter = 0; - if (++eventCounter > 25) - { - notecard.logDebug("Demo cycle complete. Program stopped. Press RESET to restart.\n"); - delay(10000); // 10 seconds - return; - } - // Read the notecard's current temperature and voltage, as simulated sensor // measurements double temperature = 0; @@ -206,7 +196,6 @@ void loop() { JAddNumberToObject(body, "temp", temperature); JAddNumberToObject(body, "voltage", voltage); - JAddNumberToObject(body, "count", eventCounter); } notecard.sendRequest(req); } From 9521d975262fda8e54163ee28f631dedc592588f Mon Sep 17 00:00:00 2001 From: "Zachary J. Fields" Date: Fri, 29 Sep 2023 16:17:32 -0500 Subject: [PATCH 3/3] chore: update examples --- .github/workflows/note-arduino-ci.yml | 14 +++++++------- .../Example0_LibrarylessCommunication.ino | 7 ++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/note-arduino-ci.yml b/.github/workflows/note-arduino-ci.yml index 6df41af..b7d522d 100644 --- a/.github/workflows/note-arduino-ci.yml +++ b/.github/workflows/note-arduino-ci.yml @@ -109,18 +109,18 @@ jobs: - ./examples/Example8_BinarySendReceive/Example8_BinarySendReceive.ino - ./examples/Example9_BinarySendReceiveChunked/Example9_BinarySendReceiveChunked.ino fully-qualified-board-name: - - STMicroelectronics:stm32:BluesW:pnum=SWAN_R5 - - esp32:esp32:featheresp32 + - adafruit:nrf52:feather52840:softdevice=s140v6 - adafruit:samd:adafruit_feather_m4 - - STMicroelectronics:stm32:GenF4:pnum=FEATHER_F405 + # The binary examples don't fit in the Uno's flash. + # - arduino:avr:uno # TODO: Fix this. May require upstream fix. # - arduino:mbed_nano:nano33ble + - esp32:esp32:featheresp32 + - rp2040:rp2040:rpipico - SparkFun:apollo3:sfe_artemis_thing_plus + - STMicroelectronics:stm32:BluesW:pnum=SWAN_R5 + - STMicroelectronics:stm32:GenF4:pnum=FEATHER_F405 - STMicroelectronics:stm32:Nucleo_32:pnum=NUCLEO_L432KC - - adafruit:nrf52:feather52840:softdevice=s140v6 - - rp2040:rp2040:rpipico - # The binary examples don't fit in the Uno's flash. - # - arduino:avr:uno steps: - name: Checkout code diff --git a/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino b/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino index 262f875..258106f 100644 --- a/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino +++ b/examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino @@ -13,11 +13,8 @@ // Core IoT Development Kit, you would connect the R2 pin to the Notecard's TX // pin, and the M5Stack's T2 pin to the Notecard's RX pin, and then would // use Serial2. -// -// Note that both of these definitions are optional; just prefix either line -// with `//` to remove it. -// - Remove txRxPinsSerial if you wired your Notecard using I2C SDA/SCL pins -// instead of serial RX/TX + +#include "Arduino.h" #if defined(ARDUINO_ARCH_AVR) && not defined(HAVE_HWSERIAL1) #define txRxPinsSerial Serial