int address[9] ={18,19,21,22,23,27,26,25,33};
uint16_t dmxAddress;
void setup() {
Serial.begin(115200);
for(int i = 0; i<9;i++){
pinMode(address[i], INPUT_PULLUP);
}
}
void loop() {
dmxAddress=readAddress();
Serial.println(dmxAddress,HEX);
delay(500);
}
uint16_t readAddress(){
uint16_t tempAddress = 0;
for(int i = 8;i>=0;i--){
tempAddress *=2;
tempAddress |= digitalRead(address[i]);
}
return tempAddress;
}