diff --git a/src/Graph.cpp b/src/Graph.cpp new file mode 100644 index 0000000..ed1c842 --- /dev/null +++ b/src/Graph.cpp @@ -0,0 +1,8 @@ +#include "Graph.h" + +Graph::Graph (int graphSize, int graphUpdateRate) { + this->graphSize = graphSize; + this->graphUpdateRate = graphUpdateRate; // Раз в секунду + graphArray = new int[graphSize]; + graphCounter = 0; +} \ No newline at end of file diff --git a/src/Graph.h b/src/Graph.h new file mode 100644 index 0000000..e6349c6 --- /dev/null +++ b/src/Graph.h @@ -0,0 +1,9 @@ +class Graph { + public: + int graphSize; + int graphUpdateRate; + int * graphArray; + int graphCounter; + + Graph (int graphSize, int graphUpdateRate); +}; \ No newline at end of file diff --git a/src/Sensor.cpp b/src/Sensor.cpp new file mode 100644 index 0000000..aff5d50 --- /dev/null +++ b/src/Sensor.cpp @@ -0,0 +1,6 @@ +#include + +Sensor::Sensor() { + lastUpdate = 0; + lastValue = 0; +} \ No newline at end of file diff --git a/src/Sensor.h b/src/Sensor.h new file mode 100644 index 0000000..8c1e220 --- /dev/null +++ b/src/Sensor.h @@ -0,0 +1,7 @@ +class Sensor { + public: + int lastValue; + long int lastUpdate; + + Sensor(); +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 876ab3f..198e6dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,30 +4,19 @@ #include #include #include +#include +#include const char *ssid = "NodeMCU"; ESP8266WebServer server(80); + +Sensor accelerometer = Sensor(); long int lastUpdate = 0; int acc = 0; -class Graph { - public: - int graphSize; - int graphUpdateRate; - int * graphArray; - int graphCounter; - - Graph (int graphSize, int graphUpdateRate) { - this->graphSize = graphSize; - this->graphUpdateRate = graphUpdateRate; // Раз в секунду - graphArray = new int[graphSize]; - graphCounter = 0; - } -}; // Раз в секунду - -Graph graphAcc; +Graph graphAcc = Graph(200, 50); void handleAccelerometer() { @@ -88,7 +77,6 @@ void handleNotFound() void setup(void) { - graphAcc = Graph(200, 50); // Класс графики для акселерометра pinMode(A0, INPUT); Serial.begin(115200); WiFi.softAP(ssid);