Arduino Bluetooth Car

What I do is the steering gear to control the direction , A simple Bluetooth car driven by motor .
board :arduino uno;
I use the extended version :PM—R3 Motor Extended Edition (2 Circuit DC motor output );
Bluetooth module :HC-06;
steering engine :MG996R;
electric machinery : hear nothing of ;
Several DuPont lines ;
program :

int servopin=9;// Define steering gear interface digital interface 9 int myangle;// Define angle variables int pulsewidth;// Define pulse width variable int
val; char _val; const int led1=10; const int led2=11; void servopulse(int
servopin,int myangle)// Define a pulse function { pulsewidth=(myangle*11)+500;
// Convert angle to 500-2480 Pulse width value of digitalWrite(servopin,HIGH);// Turn the steering gear interface level to high delayMicroseconds(
pulsewidth);// Microseconds of delay pulse width value digitalWrite(servopin,LOW);// Turn the steering gear interface level to low delay(20-
pulsewidth/1000); } void setup() { // put your setup code here, to run once:
pinMode(6,OUTPUT);// Output pin on drive module pinMode(7,OUTPUT);// Output pin on drive module pinMode(servopin,
OUTPUT); Serial.begin(9600); Serial.println(" System ready "); } void loop() { // put
your main code here, to run repeatedly: _val = Serial.read();// Read the value of the serial port switch(
_val){ case 'g': // forward digitalWrite(6,HIGH); digitalWrite(7,LOW);break; case 'b':
// back off digitalWrite(6,HIGH); digitalWrite(7,HIGH);break; case 's': // The car stopped
digitalWrite(6,LOW); digitalWrite(7,LOW);break; case 'z': // Trolley left steering val=60; Serial
.print("moving servo to "); // Displays the steering gear rotation angle Serial.print(val,DEC); Serial.println();
for(int i=0;i<=30;i++)// Give the steering gear enough time to turn it to the specified angle { servopulse(servopin,val);// Reference pulse function }
break; case 'y': // Trolley turn right val=140; Serial.print("moving servo to "); Serial.print(
val,DEC); Serial.println(); for(int i=0;i<=30;i++)// Give the steering gear enough time to turn it to the specified angle {
servopulse(servopin,val);// Reference pulse function } break; case 'h':
// Return the trolley to the right direction ; I define the steering gear angle as 100 The direction is positive val = 100; Serial.print("moving servo to ");
Serial.print(val,DEC); Serial.println(); for(int i=0;i<=30;i++)
// Give the steering gear enough time to turn it to the specified angle { servopulse(servopin,val);// Reference pulse function }break; case 'a':
// Here are the lights that control the car digitalWrite(led1,HIGH); digitalWrite(led2,LOW);break; case 'c':
digitalWrite(led1,LOW); digitalWrite(led2,HIGH);break; case 'k': digitalWrite(
led1,LOW); digitalWrite(led2,LOW);break; case 'q': digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);break; default: break; } }

YYM, to LZ give the thumbs-up !!!!
Finally, I wish you a happy New Year ;

Technology