const int led1 = 2;
const int led2 = 3;
const int led3 = 4;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println('Enter command');
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available() > 0) {
String command = Serial.readString();
command.trim();
if (command == "L1_ON") {
digitalWrite(led1, HIGH);
}
else if (command == "L1_OFF") {
digitalWrite(led1, LOW);
}
else if (command == "L2_ON") {
digitalWrite(led1, HIGH);
}
else if (command == "L2_OFF") {
digitalWrite(led1, LOW);
}
else if (command == "L3_ON") {
digitalWrite(led1, HIGH);
}
else if (command == "L3_OFF") {
digitalWrite(led1, LOW);
}
else {
Serial.println('Typing error');
}
}
}