void serialEvent() {
while (Serial.available()) {
char inc = (char)Serial.read();//將byte轉成 char
if (inc=='1') D=100;
else if (inc=='2') D=200;
…….
else if (inc=='9') D=900;
Serial.print("now D=");
Serial.println(D);
}