int ledPin = 7;
int state = 0;

void setup()  
{
   pinMode(ledPin,OUTPUT);
  // Open serial communications and wait for port to open:
  Serial.begin(115200);

}
  
void loop() {
  // put your main code here, to run repeatedly:
  if(Serial.available()>0){
    state = Serial.read();
    }
  if(state == '0'){
    digitalWrite(ledPin,LOW);
    Serial.println("LED: OFF");
    state = 0;
    }
   else if(state == '1'){
    digitalWrite(ledPin,HIGH);
    Serial.println("LED: ON");
    state = 0;
    }   
}
