void setup() {
Serial.begin(115200);
randomSeed(analogRead(A0));
}
void loop() {
int i, j, x = random(256), y = random(256);
showbits(x);
Serial.print(" || ");
showbits(y);
Serial.print(" (");
pad (x);
Serial.print(x);
Serial.print(" || ");
pad (y);
Serial.print(y);
Serial.print(") = ");
Serial.print(x || y, BIN);
Serial.println();
delay(250);
}
void showbits(byte val) {
for (int i = 7; i >= 0; i--)
Serial.print(bitRead(val, i));
}
void pad(int val) {
if (val < 100) Serial.print(" ");
if (val < 10) Serial.print(" ");
}