char data='0';
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(7, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()!=0){
data=Serial.read();
if(data=='0'){
digitalWrite(7, LOW);
Serial.println("LED will off.");
}else if(data=='1'){
digitalWrite(7, HIGH);
Serial.println("LED will on.");
}
}
}