void setup() {
for (int i = 0; i < 8; i++) {
pinMode(i, OUTPUT);
}
}
void loop() {
int myBit = 0b01001101;
displayBits(myBit);
delay(2000);
int notMyBit = ~myBit;
displayBits(notMyBit);
delay(2000);
}
void displayBits(uint8_t bits) {
for (int i = 0; i < 8; i++) {
digitalWrite(i, bitRead(bits, i));
}
}