-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFactoryReset.ino
35 lines (28 loc) · 1008 Bytes
/
FactoryReset.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* This example shows how to restore the factory settings of the Nicla Sense Env.
*
* Initial author: Sebastian Romero (s.romero@arduino.cc)
*/
#include "Arduino_NiclaSenseEnv.h"
void setup() {
Serial.begin(115200);
while (!Serial) {
// Wait for serial port to connect
}
// Change to your custom address if you have changed it before (e.g., 0x22)
uint8_t customDeviceAddress = NiclaSenseEnv::DEFAULT_DEVICE_ADDRESS;
NiclaSenseEnv device(customDeviceAddress);
if (device.begin()) {
Serial.println("🔌 Device connected.");
// Restore factory settings
Serial.println("🔄 Restoring factory settings...");
bool success = device.restoreFactorySettings();
Serial.print("🔧 Factory settings restored: ");
Serial.println(success ? "true" : "false");
} else {
Serial.println("🤷 Device could not be found. Please double-check the wiring.");
}
}
void loop() {
// Code in the loop if needed
}