#define led1 32
#define led2 33
#define led3 25
#define led4 26
#define led5 27
char key;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello.");
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
}
void loop() {
if(Serial.available()>0){
key = Serial.read();
if(key != '\n'){
if(key=='a'){
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);
digitalWrite(led5,HIGH);
}if(key=='b'){
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
digitalWrite(led4,LOW);
digitalWrite(led5,LOW);
}
if(key=='c'){
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
digitalWrite(led4,LOW);
digitalWrite(led5,HIGH);
}if(key=='d'){
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,LOW);
digitalWrite(led5,LOW);
}if(key=='W'){
Serial.println("Move Forward.");
}if(key=='A'){
Serial.println("Move left.");
}if(key=='D'){
Serial.println("Move Right.");
}if(key=='Z'){
Serial.println("Move back.");
}
}
}
}