const int ledPins[] = {5,4,3,2};
const int numPins = 4;
static int arr[4];
void setup() {
// put your setup code here, to run once:
for (int i = 0; i < numPins; i++) {
pinMode(ledPins[i], OUTPUT);
digitalWrite(ledPins[i],LOW);
}
}
void loop() {
// put your main code here, to run repeatedly:
for(int i=0;i<15;i=i+2){
bnary(i);
delay(1000);
}
delay(2000);
}
void bnary(int n){
for(int i=0;i<numPins;i++)
{
int x=n%2;
arr[i]=x;
n=n/2;
if(arr[i]==1)
digitalWrite(ledPins[i],HIGH);
else
digitalWrite(ledPins[i],LOW);
}
}