Skip to content

Commit 934081f

Browse files
authored
Merge pull request #39 from arduino/fix_ble_sketch
Fix issues with Portenta_BLE_Bridge + add instructions for IoT bridge examples
2 parents 162c5bf + b9d0904 commit 934081f

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

examples/Nicla_IoT_Bridge/Nicla_IoT_Bridge.ino

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* Upload this sketch to a Host board to use it as an I2C bridge between
3+
* Nicla Sense ME and the Arduino Cloud.
4+
* Nicla Sense ME board needs to run the basic App.ino sketch and to be plugged
5+
* as a shield on top of the Host board.
6+
*
7+
* Before uploading this sketch to the Host board:
8+
* - add your Host device to Arduino Cloud
9+
* - setup temperature and seconds Things in Arduino Cloud
10+
* - get the THING_ID and copy it in thingProperties.h
11+
* - create a Dashboard in Arduino Cloud, like a live chart of the temperature
12+
*/
13+
114
#include "thingProperties.h"
215

316
#include "Arduino_BHY2Host.h"

examples/Portenta_BLE_Bridge/Portenta_BLE_Bridge.ino

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
* Upload this sketch to Portenta to use it as a BLE bridge between
3+
* Nicla Sense ME and the Arduino Cloud.
4+
* Nicla Sense ME board needs to run the basic App.ino sketch.
5+
*
6+
* Before uploading this sketch to Portenta:
7+
* - add your Portenta device to Arduino Cloud
8+
* - setup temperature and seconds Things in Arduino Cloud
9+
* - get the THING_ID and copy it in thingProperties.h
10+
* - create a Dashboard in Arduino Cloud, like a live chart of the temperature
11+
*/
12+
113
#include <ArduinoIoTCloud.h>
214
#include <Arduino_ConnectionHandler.h>
315
#include "thingProperties.h"
@@ -19,7 +31,7 @@ void setup() {
1931
#endif
2032

2133
#if DEBUG
22-
BHY2.debug(Serial);
34+
BHY2Host.debug(Serial);
2335
#endif
2436

2537
// Defined in thingProperties.h
@@ -64,9 +76,3 @@ void loop() {
6476
ArduinoCloud.update();
6577

6678
}
67-
68-
void onTemperatureChange() {
69-
}
70-
71-
void onSecondsChange() {
72-
}

examples/Portenta_BLE_Bridge/thingProperties.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ const char THING_ID[] = "";
55
const char SSID[] = SECRET_SSID; // Network SSID (name)
66
const char PASS[] = SECRET_PASS; // Network password (use for WPA, or use as key for WEP)
77

8-
void onTemperatureChange();
9-
void onSecondsChange();
10-
118
float temperature;
129
int seconds;
1310

1411
void initProperties(){
1512

1613
ArduinoCloud.setThingId(THING_ID);
17-
ArduinoCloud.addProperty(temperature, READWRITE, ON_CHANGE, onTemperatureChange);
18-
ArduinoCloud.addProperty(seconds, READWRITE, ON_CHANGE, onSecondsChange);
14+
ArduinoCloud.addProperty(temperature, READ, 1 * SECONDS, NULL);
15+
ArduinoCloud.addProperty(seconds, READ, 1 * SECONDS, NULL);
1916

2017
}
2118

src/Arduino_BHY2Host.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "sensors/SensorID.h"
1616

17-
#if defined(ARDUINO_PORTENTA_H7) || defined(ARDUINO_SAMD_MKRWIFI1010)
17+
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_SAMD_MKRWIFI1010)
1818
#define __BHY2_HOST_BLE_SUPPORTED__
1919
#include "BLEHandler.h"
2020
#endif

0 commit comments

Comments
 (0)