Skip to content

Commit c5f46b1

Browse files
authored
Update README.md
1 parent febbd5e commit c5f46b1

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,27 @@ int age = storage.get<int>("age");
3131
float temperature = storage.get<float>("temperature");
3232
bool isSwitchOn = storage.get<bool>("switch_state");
3333
```
34-
3. Add values to an array in the server.
34+
3. Add values to an array in the server
3535
```C++
3636
storage.add<float>("sensor_values", getCurrentSensorValue());
3737
storage.add<String>("startup_dates", "17.12.2018");
3838
```
39+
4. Pop values from an array in the server
40+
```C++
41+
String color = storage.pop<String>("colors_to_show", PopFrom_End);
42+
float temp = storage.pop<float>("tempertures", PopFrom_Start);
43+
```
44+
```C++
45+
// More advanced example of pop. In the previous example the returned value is
46+
// implicitly casted into the required return type (String, float etc..)
47+
while(true) {
48+
auto popResult = storage.pop<String>("lines_to_print", PopFrom_Start);
49+
if(popResult.isOK == false) break;
50+
proccessLine(popResult.value);
51+
if(popResult.hasNext == false) break;
52+
}
53+
```
54+
3955

4056
# Requirements
4157
* This library uses the `ArduinoJson` library as a depedency.

0 commit comments

Comments
 (0)