Skip to content

Commit 2679b4b

Browse files
committed
Update sketch
1 parent baea51e commit 2679b4b

File tree

1 file changed

+7
-6
lines changed
  • content/hardware/05.nicla/boards/nicla-sense-me/tutorials/web-ble-dashboard

1 file changed

+7
-6
lines changed

content/hardware/05.nicla/boards/nicla-sense-me/tutorials/web-ble-dashboard/content.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ If you use a local IDE you can copy & paste the following sketch:
6060
6161
Hardware required: https://store.arduino.cc/nicla-sense-me
6262
63-
1) Upload this sketch to the Arduino Nano BLE sense board
63+
1) Upload this sketch to the Arduino Nano Bluetooth® Low Energy sense board
6464
6565
2) Open the following web page in the Chrome browser:
6666
https://arduino.github.io/ArduinoAI/NiclaSenseME-dashboard/
@@ -79,7 +79,7 @@ If you use a local IDE you can copy & paste the following sketch:
7979
#include "Arduino_BHY2.h"
8080
#include <ArduinoBLE.h>
8181
82-
#define BLE_SENSE_UUID(val) ("19b10000" val "-537e-4f6c-d104768a1214")
82+
#define BLE_SENSE_UUID(val) ("19b10000-" val "-537e-4f6c-d104768a1214")
8383
8484
const int VERSION = 0x00000000;
8585
@@ -91,7 +91,7 @@ If you use a local IDE you can copy & paste the following sketch:
9191
BLEFloatCharacteristic pressureCharacteristic(BLE_SENSE_UUID("4001"), BLERead);
9292
9393
BLECharacteristic accelerometerCharacteristic(BLE_SENSE_UUID("5001"), BLERead | BLENotify, 3 * sizeof(float)); // Array of 3x 2 Bytes, XY
94-
BLECharacteristic gyroscopeCharacteristic(BLE_SENSE_UUID("6001"), BLERead | BLENotify, 3 * sizeof(int16_t)); // Array of 3x 2 Bytes, XYZ
94+
BLECharacteristic gyroscopeCharacteristic(BLE_SENSE_UUID("6001"), BLERead | BLENotify, 3 * sizeof(float)); // Array of 3x 2 Bytes, XYZ
9595
BLECharacteristic quaternionCharacteristic(BLE_SENSE_UUID("7001"), BLERead | BLENotify, 4 * sizeof(float)); // Array of 4x 2 Bytes, XYZW
9696
9797
BLECharacteristic rgbLedCharacteristic(BLE_SENSE_UUID("8001"), BLERead | BLEWrite, 3 * sizeof(byte)); // Array of 3 bytes, RGB
@@ -122,7 +122,7 @@ If you use a local IDE you can copy & paste the following sketch:
122122
nicla::leds.setColor(green);
123123
124124
//Sensors initialization
125-
BHY2.begin();
125+
BHY2.begin(NICLA_STANDALONE);
126126
temperature.begin();
127127
humidity.begin();
128128
pressure.begin();
@@ -133,7 +133,7 @@ If you use a local IDE you can copy & paste the following sketch:
133133
gas.begin();
134134
135135
if (!BLE.begin()){
136-
Serial.println("Failed to initialized Bluetooth® Low Energy!");
136+
Serial.println("Failed to initialized BLE!");
137137
138138
while (1)
139139
;
@@ -241,7 +241,7 @@ If you use a local IDE you can copy & paste the following sketch:
241241
}
242242
243243
void onHumidityCharacteristicRead(BLEDevice central, BLECharacteristic characteristic){
244-
uint8_t humidityValue = humidity.value();
244+
uint8_t humidityValue = humidity.value() + 0.5f; //since we are truncating the float type to a uint8_t, we want to round it
245245
humidityCharacteristic.writeValue(humidityValue);
246246
}
247247
@@ -272,6 +272,7 @@ If you use a local IDE you can copy & paste the following sketch:
272272
273273
nicla::leds.setColor(r, g, b);
274274
}
275+
275276
```
276277

277278
### Connect to the Dashboard

0 commit comments

Comments
 (0)