//REVERSE COUNTING USING BITREAD FUNCTION
const int ledPins[] = {5,4,3,2};
int count = 15;
void setup() {
for(int j = 0; j < 4; j++)
{
pinMode(ledPins[j], OUTPUT);
}
}
void loop() {
for(int j = 0; j < 4; j++)
{
digitalWrite(ledPins[j], bitRead(count,j));
}
count--;
if(count < 0)
{
count = 15;
}
delay(1000);
}
//const int ledPins[] = {5,4,3,2};
//int count = 0;
//void setup() {
//for(int j = 0; j < 4; j++)
// {
//pinMode(ledPins[j], OUTPUT);
////}
//}
//void loop() {
//for(int j = 0; j < 4; j++)
//{
//digitalWrite(ledPins[j], not bitRead(count,j));
// }
//count++;
//if(count == 16)
// {
// count = 0;
//}
//delay(1000);
//}