ขอถามเกี่ยวกับ โค้ด arduino หน่อยครับ

#include  <SoftwareSerial.h>
SoftwareSerial mySerial (1,0); // rx, tx
const int R1=2;
const int Y1=3;
const int G1=4;
const int R2=5;
const int Y2=6;
const int G2=7;
const int R3=8;
const int Y3=9;
const int G3=10;
const int R4=11;
const int Y4=12;
const int G4=13;

void setup()
{
  mySerial.begin(9600);

}
void loop()
{
    if (mySerial.available()>0)
    {
       char x = mySerial.read();
          if (x=='A')
    {
      digitalWrite(R1,HIGH);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,LOW);
      digitalWrite(R2,HIGH);
      digitalWrite(Y2,LOW);
      digitalWrite(G2,LOW);
      digitalWrite(R3,HIGH);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,LOW);
      digitalWrite(R4,HIGH);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,LOW);
      delay(3000);
            digitalWrite(R1,LOW);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,HIGH);
      digitalWrite(R2,HIGH);
      digitalWrite(Y2,LOW);
      digitalWrite(G2,LOW);
      digitalWrite(R3,HIGH);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,LOW);
      digitalWrite(R4,HIGH);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,LOW);
      delay(5000);
         digitalWrite(R1,LOW);
      digitalWrite(Y1,HIGH);
      digitalWrite(G1,LOW);
      digitalWrite(R2,HIGH);
      digitalWrite(Y2,LOW);
      digitalWrite(G2,LOW);
      digitalWrite(R3,HIGH);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,LOW);
      digitalWrite(R4,HIGH);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,LOW);
      delay(3000);
         digitalWrite(R1,HIGH);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,LOW);
      digitalWrite(R2,LOW);
      digitalWrite(Y2,LOW);
      digitalWrite(G2,HIGH);
      digitalWrite(R3,HIGH);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,LOW);
      digitalWrite(R4,HIGH);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,LOW);
      delay(5000);
         digitalWrite(R1,HIGH);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,LOW);
      digitalWrite(R2,LOW);
      digitalWrite(Y2,HIGH);
      digitalWrite(G2,LOW);
      digitalWrite(R3,HIGH);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,LOW);
      digitalWrite(R4,HIGH);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,LOW);
      delay(3000);
        digitalWrite(R1,HIGH);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,LOW);
      digitalWrite(R2,HIGH);
      digitalWrite(Y2,LOW);
      digitalWrite(G2,LOW);
      digitalWrite(R3,LOW);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,HIGH);
      digitalWrite(R4,HIGH);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,LOW);
      delay(5000);
        digitalWrite(R1,HIGH);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,LOW);
      digitalWrite(R2,LOW);
      digitalWrite(Y2,HIGH);
      digitalWrite(G2,LOW);
      digitalWrite(R3,LOW);
      digitalWrite(Y3,HIGH);
      digitalWrite(G3,LOW);
      digitalWrite(R4,HIGH);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,LOW);
      delay(3000);
         digitalWrite(R1,HIGH);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,LOW);
      digitalWrite(R2,HIGH);
      digitalWrite(Y2,LOW);
      digitalWrite(G2,LOW);
      digitalWrite(R3,HIGH);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,LOW);
      digitalWrite(R4,LOW);
      digitalWrite(Y4,LOW);
      digitalWrite(G4,HIGH);
      delay(5000);
         digitalWrite(R1,HIGH);
      digitalWrite(Y1,LOW);
      digitalWrite(G1,LOW);
      digitalWrite(R2,HIGH);
      digitalWrite(Y2,LOW);
      digitalWrite(G2,LOW);
      digitalWrite(R3,HIGH);
      digitalWrite(Y3,LOW);
      digitalWrite(G3,LOW);
      digitalWrite(R4,LOW);
      digitalWrite(Y4,HIGH);
      digitalWrite(G4,LOW);
      delay(3000);
    }
    }
}
      
      
       คือโค้ดนี้ผมควบคุมผ่านโทรศัพท์ครับ แต่มันไม่ วน ให้อ่ะครับ  ผมอยากให้มันวน ต้องทำยังไงครับ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่