YenDauChan.26678
e đã cố chèn kiểu này rồi mà nó không chịu jump ra thì làm ntn vậy chị int val = 0;
int A=6;
int B=5;
int C=2;
int D=3;
int E=4;
int F=7;
int G=8;
int H=10;
int DP=9;
void setup()
{
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
pinMode(E, OUTPUT);
pinMode(F, OUTPUT);
pinMode(G, OUTPUT);
pinMode(H, INPUT);
pinMode(DP, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop(){
// val = digitalRead(10);
if (val == HIGH) { goto nsr; }
{
digitalWrite(13,HIGH); //green
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(A,HIGH); //9
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //8
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //7
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,LOW);
digitalWrite(E,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //6
digitalWrite(B,LOW);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //5
digitalWrite(B,LOW);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,LOW); //4
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,LOW);
digitalWrite(E,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //3
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,LOW);
digitalWrite(F,LOW);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //2
digitalWrite(B,HIGH);
digitalWrite(C,LOW);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,LOW);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,LOW); //1
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,LOW);
digitalWrite(E,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //0
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,HIGH);
digitalWrite(G,LOW);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(13,LOW); //yellow
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(A,HIGH); //3
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,LOW);
digitalWrite(F,LOW);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //2
digitalWrite(B,HIGH);
digitalWrite(C,LOW);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,LOW);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,LOW); //1
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,LOW);
digitalWrite(E,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //0
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,HIGH);
digitalWrite(G,LOW);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(13,LOW); //red
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(A,HIGH); //5
digitalWrite(B,LOW);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,LOW); //4
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,LOW);
digitalWrite(E,LOW);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //3
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,LOW);
digitalWrite(F,LOW);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //2
digitalWrite(B,HIGH);
digitalWrite(C,LOW);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,LOW);
digitalWrite(G,HIGH);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,LOW); //1
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,LOW);
digitalWrite(E,LOW);
digitalWrite(F,LOW);
digitalWrite(G,LOW);
delay(1000);
if (val == HIGH) { goto nsr; }
digitalWrite(A,HIGH); //0
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,HIGH);
digitalWrite(E,HIGH);
digitalWrite(F,HIGH);
digitalWrite(G,LOW);
delay(1000);
if (val == HIGH) { goto nsr; }
}
nsr:
digitalWrite(13,LOW); //OFF
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(A,LOW); //H
digitalWrite(B,HIGH);
digitalWrite(C,HIGH);
digitalWrite(D,LOW);
digitalWrite(E,HIGH);
digitalWrite(F,HIGH);
digitalWrite(G,HIGH);
Serial.println("Motion detected!");
delay(1000);
}