#include "MyClass.h"
const unsigned int SIZE = 16;
int leds[] = {53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23};
int switches[] = {21, 20, 19, 18, 17, 16, 15, 14, 2, 3, 4, 5, 6, 7, 8, 9};
int extraLeds[] = {50, 48};
int button = 13;
MyClass output[SIZE];
bool command;
bool state;
unsigned long value;
unsigned long logging;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
for (int i = 0; i < SIZE; i++) {
output[i]= MyClass(leds[i], switches[i], button);
}
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i < SIZE; i++) {
output[i].switchLedFeedback(500);
}
for(int i = 0; i < SIZE; i++){
state = output[i].ledState(); //binaire waarde van led
//Serial.print(state);
if(state){
value |= (1UL<<i);
}
else{
value &= ~(1UL<<i);
}
}
delay(100);
if(value != logging){
Serial.println(value, BIN);
Serial.println(value, HEX);
Serial.println(value);
Serial.println("----------");
}
logging = value;
digitalWrite(extraLeds[0], !digitalRead(button));
digitalWrite(extraLeds[1], true);
}