#undef MyHW
#ifdef MyHW
const int button = A0;
const byte pins[] = {2, 3, 4, 5, 6};
#else
int button = A0; // pin to connect the button
byte pins[] = {2, 3, 4, 5, 6};
#endif
const byte numPins = sizeof(pins);
byte presses = 0; // variable to store number of presses
byte butLst;
void setup()
{
Serial.begin (9600);
for (int i = 0; i < numPins; i++)
pinMode(pins[i], OUTPUT);
pinMode(button, INPUT_PULLUP);
}
void loop()
{
byte but = digitalRead (button);
if (butLst != but) {
butLst = but;
delay (10); // debounce
if (LOW == but)
presses++;
}
for (int i = 0; i < numPins; i++)
digitalWrite (pins[i], presses & 1<<i);
}