From 84d6461dc76df4061a420735a42a3cf29623e81b Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 2 Apr 2025 14:49:22 +0200 Subject: add voting functions and example --- Mussel/Mussel.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Mussel/Mussel.h') diff --git a/Mussel/Mussel.h b/Mussel/Mussel.h index 79f5017..1e94897 100644 --- a/Mussel/Mussel.h +++ b/Mussel/Mussel.h @@ -22,6 +22,9 @@ // milliseconds #define MUSSEL_DEBOUNCE_DELAY 50U +// Limited size NOW!! can be transformed into infinite array +#define STACK_SIZE 1000 + class Mussel { public: @@ -41,6 +44,9 @@ class Mussel { String desc(); byte read(); String debug(); + bool push(String id, unsigned long timestamp, int measure); + void printStack(); + private: int _attitude; int _pin; @@ -50,6 +56,14 @@ class Mussel { #ifdef DHT_H DHT mussel_dht; #endif + + // Array to store ID strings + String idStack[STACK_SIZE]; + unsigned long timeStack[STACK_SIZE]; + int measureStack[STACK_SIZE]; + + // Index of the top element in the stack, -1 means stack is empty + int top = -1; }; #endif -- cgit v1.2.3