aboutsummaryrefslogtreecommitdiff
path: root/mussel6/mussel6.ino
blob: 0886a4ac3098d3123067f4aeecda5978d2a1f698 (plain)
  1. const int ledPin = 13; // LED connected to digital pin 13
  2. void setup() {
  3. pinMode(ledPin, OUTPUT);
  4. Serial.begin(9600);
  5. Serial.println("Enter 'ON' to turn the LED on, or 'OFF' to turn it off.");
  6. }
  7. void loop() {
  8. if (Serial.available() > 0) {
  9. String command = Serial.readStringUntil('\n');
  10. command.trim();
  11. if (command.equalsIgnoreCase("ON")) {
  12. digitalWrite(ledPin, HIGH);
  13. Serial.println("LED is now ON.");
  14. }
  15. else if (command.equalsIgnoreCase("OFF")) {
  16. digitalWrite(ledPin, LOW);
  17. Serial.println("LED is now OFF.");
  18. }
  19. else {
  20. Serial.println("Invalid command. Please type 'ON' or 'OFF'.");
  21. }
  22. }
  23. }