aboutsummaryrefslogtreecommitdiff
path: root/mussel3
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-02-26 13:39:31 +0100
committerJonas Smedegaard <dr@jones.dk>2025-02-26 13:40:18 +0100
commitdbbde95ae72907b6f3ad4731ddcfdb8782b4035b (patch)
tree589c33a7bf1fa0afdeaa424134a8992be70416ac /mussel3
parent981a96f7680cf285ec8d196ad527766b467ad9ac (diff)
add more mussels
Diffstat (limited to 'mussel3')
-rw-r--r--mussel3/mussel3.ino46
1 files changed, 46 insertions, 0 deletions
diff --git a/mussel3/mussel3.ino b/mussel3/mussel3.ino
new file mode 100644
index 0000000..0777b01
--- /dev/null
+++ b/mussel3/mussel3.ino
@@ -0,0 +1,46 @@
+/// mussel3 - mussel voter influenced by Humidity
+///
+/// SPDX-License-Identifier: GPL-3.0-or-later
+/// SPDX-FileCopyrightText: 2025 Noor Ahmad <noora@ruc.dk>
+
+
+#include <DHT.h>
+#include <Arduino.h>
+
+
+#define DHTPIN 15 // Digital pin connected to the DHT sensor - red
+#define DHTTYPE DHT11
+#define ESC_SIGNAL_PIN 19 //white
+DHT dht(DHTPIN, DHTTYPE);
+
+
+void setup() {
+ Serial.begin(9600);
+ dht.begin();
+}
+
+void loop() {
+ // Wait a few seconds between measurements
+ delay(1000);
+
+ vote();
+
+
+
+ delay(1000); // Delay between sensor readings
+}
+void vote() {
+
+ float temperature = dht.readTemperature(); // Read temperature as Celsius
+
+ // Print temperature
+ Serial.print("Temperature: ");
+ Serial.print(temperature);
+ Serial.println("°C");
+
+ int lightValue = analogRead(34); // GPIO34 (analog pin) - blue
+
+ // Print the light sensor value to Serial Monitor
+ Serial.print("Light Sensor Value: ");
+ Serial.println(lightValue);
+} \ No newline at end of file