Small grammar fixes and clarifications (#1003)
* Small grammar fixes and clarifications Just fixed some small grammar issues in the comments and clarified a few things that might seem confusing. * More spelling fixes that I introduced...
This commit is contained in:
parent
528caff7f9
commit
964287727f
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
ESP32 start counter example with Preferences library
|
ESP32 startup counter example with Preferences library.
|
||||||
|
|
||||||
This simple example demonstrate using Preferences library to store how many times
|
This simple example demonstrates using the Preferences library to store how many times
|
||||||
was ESP32 module started. Preferences library is wrapper around Non-volatile
|
the ESP32 module has booted. The Preferences library is a wrapper around the Non-volatile
|
||||||
storage on ESP32 processor.
|
storage on ESP32 processor.
|
||||||
|
|
||||||
created for arduino-esp32 09 Feb 2017
|
created for arduino-esp32 09 Feb 2017
|
||||||
@ -17,29 +17,29 @@ void setup() {
|
|||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
// Open Preferences with my-app namespace. Each application module, library, etc.
|
// Open Preferences with my-app namespace. Each application module, library, etc
|
||||||
// has to use namespace name to prevent key name collisions. We will open storage in
|
// has to use a namespace name to prevent key name collisions. We will open storage in
|
||||||
// RW-mode (second parameter has to be false).
|
// RW-mode (second parameter has to be false).
|
||||||
// Note: Namespace name is limited to 15 chars
|
// Note: Namespace name is limited to 15 chars.
|
||||||
preferences.begin("my-app", false);
|
preferences.begin("my-app", false);
|
||||||
|
|
||||||
// Remove all preferences under opened namespace
|
// Remove all preferences under the opened namespace
|
||||||
//preferences.clear();
|
//preferences.clear();
|
||||||
|
|
||||||
// Or remove the counter key only
|
// Or remove the counter key only
|
||||||
//preferences.remove("counter");
|
//preferences.remove("counter");
|
||||||
|
|
||||||
// Get a counter value, if key is not exist return default value 0
|
// Get the counter value, if the key does not exist, return a default value of 0
|
||||||
// Note: Key name is limited to 15 chars too
|
// Note: Key name is limited to 15 chars.
|
||||||
unsigned int counter = preferences.getUInt("counter", 0);
|
unsigned int counter = preferences.getUInt("counter", 0);
|
||||||
|
|
||||||
// Increase counter
|
// Increase counter by 1
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
// Print counter to a Serial
|
// Print the counter to Serial Monitor
|
||||||
Serial.printf("Current counter value: %u\n", counter);
|
Serial.printf("Current counter value: %u\n", counter);
|
||||||
|
|
||||||
// Store counter to the Preferences
|
// Store the counter to the Preferences
|
||||||
preferences.putUInt("counter", counter);
|
preferences.putUInt("counter", counter);
|
||||||
|
|
||||||
// Close the Preferences
|
// Close the Preferences
|
||||||
|
Loading…
Reference in New Issue
Block a user