diff --git a/docs/node-documentation/NodeClassDocumentation.md b/docs/node-documentation/NodeClassDocumentation.md new file mode 100644 index 0000000..d0bc370 --- /dev/null +++ b/docs/node-documentation/NodeClassDocumentation.md @@ -0,0 +1,20 @@ +# OOP within Arduino + +Object-Oriented Programming (OOP) is a way of programing that provides a means of structuring your code so the code is modular and can be used more often without making huge changes or having to copy past the same code. + +## Abstraction + +Abstraction in OOP is the process of exposing only the required essential variables and functions. This means hiding the complexity and only showing the essential features of the object. In Arduino, this could mean creating a class like `Sensor node` with methods such as `setUp()`, `displayData()`, and `checkForError()`. + +## Encapsulation + +Encapsulation is the technique used to hide the data and methods within an object and prevent outside access. In Arduino, this could mean having private variables and methods in a class that can only be accessed and modified through public methods. + +## Which classes did we use + +In this Arduino project, we used several classes to organize our code and manage the complexity of the project. Some of these classes include: + +- `websockets`: This class is responsible for managing the WebSocket connections. +- `nodeReadings`: This class is responsible for managing the sensor readings. + +Each of these classes encapsulates the data and methods related to a specific part of the project, making the code easier to understand and maintain. \ No newline at end of file diff --git a/docs/node-documentation/nodeClass.md b/docs/node-documentation/nodeClass.md deleted file mode 100644 index 02723d4..0000000 --- a/docs/node-documentation/nodeClass.md +++ /dev/null @@ -1,69 +0,0 @@ -# OOP within Arduino - -### Why use classes - - - -### Abstraction - -### Encaptiolation - -### Inheritance - -### Polymorphism - -## Whitch classes did we use - -### Uml diagram - ---- -title: Arduino classes ---- -classDiagram - class Websockets - Websockets: - - -Class Websockets: - Public: - websockets(); - void hexdump(const void *mem, uint32_t len, uint8_t cols = 16); - void websocketSetup(); - void loop(); - void webSocketEvent(WStype_t type, uint8_t * payload, size_t length); - void sendMyText(String message); - - private: - WebSocketsClient *webSocket; - WiFiMulti *_WiFiMulti; - -Class NodeReadings: -public: - nodeReadings(); - void setup(); - void loop(); - void resetValues(); - void update(); - void checkForError(); - void displayData(); - -private: - DHT *dht; - Adafruit_SH1106G *display; - websockets *webSocket; - Adafruit_SGP30 *sgp; - - uint16_t TVOC_base, eCO2_base; - uint16_t counter; - uint16_t eCO2; - uint16_t TVOC; - uint16_t interval; - float temperature; - float humidity; - unsigned long currentMillis; - unsigned long lastMillis; - bool errorSGP30; - bool errorDHT11; - bool noise; - -### Small explenation \ No newline at end of file diff --git a/docs/node-documentation/nodeClassUml.md b/docs/node-documentation/nodeClassUml.md new file mode 100644 index 0000000..2259384 --- /dev/null +++ b/docs/node-documentation/nodeClassUml.md @@ -0,0 +1,43 @@ +### Uml diagram: + +``` mermaid +classDiagram + +namespace Esp { + class Websockets{ + +webSocket + +_WiFiMulti + hexdump() + websocketSetup() + loop() + webSocketEvent() + sendMyText() + } + + class NodeReadings{ + + +TVOC_base, eCO2_base + +counter + +eCO2 + +TVOC + +interval + +temperature + +humidity + +currentMillis + +lastMillis + +errorSGP30 + +errorDHT11 + +noise + + setup() + loop() + resetValues() + update() + checkForError() + displayData() + + } + + +} +```