////By NMD Weerasinghe @ COTMD

#define LED1Pin 2
#define command1 "on"
#define command2 "off"

String serialCommand ="";
 //String command1 "on";
 //String command2 "off";

void setup() {
  pinMode(LED1Pin, OUTPUT);
  Serial.begin(9600);
  Serial.println(" Enter the command !");

}

void loop() {

if(Serial.available()>0)
{

serialCommand = Serial.readString();
Serial.println(serialCommand);
  if(serialCommand == command1)
  {
    digitalWrite(LED1Pin,HIGH);
  }

  if(serialCommand == command2)  // send command "on off"
  {
    digitalWrite(LED1Pin,LOW);
  }

  
  

}


}