aboutsummaryrefslogtreecommitdiff
path: root/mussel3/mussel3.ino
blob: 0777b01b5d2bdd195bdd3bcbe0a12115e1119b38 (plain)
  1. /// mussel3 - mussel voter influenced by Humidity
  2. ///
  3. /// SPDX-License-Identifier: GPL-3.0-or-later
  4. /// SPDX-FileCopyrightText: 2025 Noor Ahmad <noora@ruc.dk>
  5. #include <DHT.h>
  6. #include <Arduino.h>
  7. #define DHTPIN 15 // Digital pin connected to the DHT sensor - red
  8. #define DHTTYPE DHT11
  9. #define ESC_SIGNAL_PIN 19 //white
  10. DHT dht(DHTPIN, DHTTYPE);
  11. void setup() {
  12. Serial.begin(9600);
  13. dht.begin();
  14. }
  15. void loop() {
  16. // Wait a few seconds between measurements
  17. delay(1000);
  18. vote();
  19. delay(1000); // Delay between sensor readings
  20. }
  21. void vote() {
  22. float temperature = dht.readTemperature(); // Read temperature as Celsius
  23. // Print temperature
  24. Serial.print("Temperature: ");
  25. Serial.print(temperature);
  26. Serial.println("°C");
  27. int lightValue = analogRead(34); // GPIO34 (analog pin) - blue
  28. // Print the light sensor value to Serial Monitor
  29. Serial.print("Light Sensor Value: ");
  30. Serial.println(lightValue);
  31. }