aboutsummaryrefslogtreecommitdiff
path: root/mussel6
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-02-27 12:39:34 +0100
committerJonas Smedegaard <dr@jones.dk>2025-02-27 12:39:34 +0100
commit77a1fc9ce08fb4d605acc56c5f3f51fd6b8d9065 (patch)
treeb37868a9e1d552c1652d7c60f71a3de214cf7176 /mussel6
parentdbbde95ae72907b6f3ad4731ddcfdb8782b4035b (diff)
add another mussel
Diffstat (limited to 'mussel6')
-rw-r--r--mussel6/mussel6.ino27
1 files changed, 27 insertions, 0 deletions
diff --git a/mussel6/mussel6.ino b/mussel6/mussel6.ino
new file mode 100644
index 0000000..0886a4a
--- /dev/null
+++ b/mussel6/mussel6.ino
@@ -0,0 +1,27 @@
+const int ledPin = 13; // LED connected to digital pin 13
+
+void setup() {
+ pinMode(ledPin, OUTPUT);
+ Serial.begin(9600);
+ Serial.println("Enter 'ON' to turn the LED on, or 'OFF' to turn it off.");
+}
+
+void loop() {
+ if (Serial.available() > 0) {
+ String command = Serial.readStringUntil('\n');
+ command.trim();
+
+ if (command.equalsIgnoreCase("ON")) {
+ digitalWrite(ledPin, HIGH);
+ Serial.println("LED is now ON.");
+ }
+ else if (command.equalsIgnoreCase("OFF")) {
+ digitalWrite(ledPin, LOW);
+ Serial.println("LED is now OFF.");
+ }
+ else {
+ Serial.println("Invalid command. Please type 'ON' or 'OFF'.");
+ }
+ }
+}
+