int a_pins[] = {14, 27, 26, 25, 33, 32, 13, 12, 23, 22, 21};
int q_pins[] = {35, 34, 15, 2 , 4 , 5 , 18, 19};
int enable = 21;
int DS = 25; // Serial Data
int OE = 14; // Output Enable
int STCP = 27; // Serial Clock
int SHCP = 26; // Storage Latch
void rs_out(uint8_t bit) {
digitalWrite(DS, bit);
digitalWrite(STCP, HIGH);
delay(100);
digitalWrite(STCP, LOW);
digitalWrite(SHCP, HIGH);
delay(100);
digitalWrite(SHCP, LOW);
}
uint8_t get_memory(uint16_t address) {
digitalWrite(SHCP, LOW);
shiftOut(DS, STCP, LSBFIRST, address);
digitalWrite(SHCP, HIGH);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
//for (int i = 0; i < 11; i++) {
// pinMode(a_pins[i], OUTPUT);
//}
for (int i = 0; i < 11; i++)
pinMode(q_pins[i], INPUT);
pinMode(DS, OUTPUT);
pinMode(enable, OUTPUT);
pinMode(OE, OUTPUT);
pinMode(STCP, OUTPUT);
pinMode(SHCP, OUTPUT);
digitalWrite(enable, HIGH);
digitalWrite(OE, LOW);
digitalWrite(STCP, LOW);
digitalWrite(SHCP, LOW);
}
int x = 0;
void loop() {
if (x == 0) {
get_memory(0b01010101010);
x = 1;
}
// put your main code here, to run repeatedly:
//digitalWrite(enable, HIGH);
//delay(1000); // this speeds up the simulation
//digitalWrite(enable, LOW);
//delay(1000); // this speeds up the simulation
delay(10);
}