const int GPIO_Pins[4]={1,4,9,13};
void setup() {
// put your setup code here, to run once:
for(int i=0;i<4;i++){
pinMode(GPIO_Pins[i], OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
for(int j=1;j<=15;j++){
if(j%2!=0){
displayBin(j);
delay(1000);
}
}
for(int k=0;k<4;k++){
digitalWrite(GPIO_Pins[k],LOW);
}
delay(2000);
}
void displayBin(int n){
int n1=n;
int r;
int i=0;
while(n1!=0){
r=n1%2;
if(r==1){
digitalWrite(GPIO_Pins[i], HIGH);
i++;
}
else{
digitalWrite(GPIO_Pins[i], LOW);
i++;
}
n1=n1/2;
}
}