blob: 0777b01b5d2bdd195bdd3bcbe0a12115e1119b38 (
plain)
- /// 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);
- }
|