aboutsummaryrefslogtreecommitdiff
path: root/Mussel/Mussel.h
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-03-11 12:02:07 +0100
committerJonas Smedegaard <dr@jones.dk>2025-03-11 16:48:06 +0100
commit02876f961fc8b68f2cb43a23a1d98d89fce11858 (patch)
treed12658d92f62c4fd957fb68e683d75b8f378428f /Mussel/Mussel.h
parent8d0212da635222b404113ad0ff5d469adf00ab6f (diff)
add library Mussel
Diffstat (limited to 'Mussel/Mussel.h')
-rw-r--r--Mussel/Mussel.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/Mussel/Mussel.h b/Mussel/Mussel.h
new file mode 100644
index 0000000..5d85068
--- /dev/null
+++ b/Mussel/Mussel.h
@@ -0,0 +1,42 @@
+/// Mussel - a small library for Arduino to emulate a mussel biosensor
+///
+/// SPDX-License-Identifier: GPL-3.0-or-later
+/// SPDX-FileCopyrightText: 2025 Jonas Smedegaard <dr@jones.dk>
+
+#ifndef Mussel_h
+#define Mussel_h
+#include "Arduino.h"
+
+#define MUSSEL_DEBOUNCE_DELAY 50U
+
+class Mussel {
+ public:
+
+ // Default constructor
+ Mussel(const int attitude);
+
+ // Constructor for attitudes using a pin
+ Mussel(const int attitude, const uint8_t pin);
+
+ // Constructor for attitudes using a pin and certain type of sensor
+ Mussel(
+ const int attitude,
+ const uint8_t pin,
+ const uint8_t type);
+
+ void begin();
+ String desc();
+ byte read();
+ String debug();
+ private:
+ int _attitude;
+ int _pin;
+ bool _boolState;
+ byte _count;
+ unsigned long _time;
+#ifdef DHT_H
+ DHT mussel_dht;
+#endif
+};
+
+#endif