Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
PicoModel.h
Go to the documentation of this file.
1#pragma once
2
4
6{
7
8 public:
9 PicoModel();
10
11 void onStart();
12
13 // Define your model properties and methods here
14 // For example, you might have properties for temperature, LED state, etc.
15
16 // Add methods to manipulate these properties
17 float getTemperature();
18
19 void setLedState(bool state);
20 bool getLedState();
21
22 bool getGpioState(int pin);
23 void setGpioState(int pin, bool state);
24
25 void saveState();
26 void restoreState();
27
28 void onNetworkReady();
29
30 private:
31 std::vector<int> activePins = { 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19 }; // Pins in use - staying away from sd card pins
32
33 bool suppressSave = false;
34
35
36};
37
Base model class for persistent JSON collections.
Provides a basic JSON-backed record model.
void setLedState(bool state)
Definition PicoModel.cpp:34
float getTemperature()
Definition PicoModel.cpp:24
void setGpioState(int pin, bool state)
Definition PicoModel.cpp:59
bool getGpioState(int pin)
Definition PicoModel.cpp:53
void saveState()
Definition PicoModel.cpp:70
bool suppressSave
Definition PicoModel.h:33
bool getLedState()
Definition PicoModel.cpp:43
void onStart()
Definition PicoModel.cpp:18
void restoreState()
Definition PicoModel.cpp:95
void onNetworkReady()
Definition PicoModel.cpp:86
std::vector< int > activePins
Definition PicoModel.h:31