// two input AND versus NAND
#define BLANKING // Comment-out to REMOVE cathode blanking
// Observe "AND" output when transitioning from BIN "1" to BIN "2" input
// NAND is not effected by blanking or unblanking
unsigned int settling = 0, viewing = 500; // gap times
void setup() {
Serial.begin(115200);
for (byte i = 0; i < 5; i++)
pinMode(i + 2, OUTPUT);
}
void loop() {
for (byte i = 0; i < 4; i++) {
Serial.print(i);
for (byte j = 0; j < 2; j++) {
digitalWrite(j * 2 + 2, i / 2); // set pin 2, 4
// delay(settling); // settling not needed
digitalWrite(j * 2 + 3, i % 2); // set pin 3, 5
// delay(settling); // settling not needed
}
#ifdef BLANKING
digitalWrite(6, LOW); // FORWARD-bias cathode to VIEW
#endif
delay(viewing); // delay for viewing duration
#ifdef BLANKING
digitalWrite(6, HIGH); // REVERSE-bias cathode to BLANK
#endif
}
Serial.println(); // serial monitor formatting
}NAND
AND
cathode on/off