/* Custom inverter chip example for Wokwi.

   How to use?
   1. Press "F1" and "Create a custom C chip (alpha)"
   2. Copy the contents of "inverter-chip.txt" to "wokwi-custom-chip.c.temp"
   3. Start the simulation. The green LED shows the output of the inverter.

*/

char *pattern[] = {
  "000",
  "001",
  "010",
  "011",
  "100",
  "101",
  "110",
  "111",
  NULL
};

int cnt = 0;

void setup() {
  pinMode(2, OUTPUT);

  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
}

void loop() {
  if (pattern[cnt][2] == '1') {
    digitalWrite(3, HIGH);
  }
  else {
    digitalWrite(3, LOW);
  }

  if (pattern[cnt][1] == '1') {
    digitalWrite(4, HIGH);
  }
  else {
    digitalWrite(4, LOW);
  }

  if (pattern[cnt][0] == '1') {
    digitalWrite(5, HIGH);
  }
  else {
    digitalWrite(5, LOW);
  }

  cnt++;
  if (pattern[cnt] == NULL) {
    cnt = 0;
  }
  delay(500);
}
74HC238Breakout