Skip to content

Instantly share code, notes, and snippets.

@gdyr
Created December 2, 2016 07:21
Show Gist options
  • Save gdyr/a5ff97ae07ceab71111a8c334c36b8f1 to your computer and use it in GitHub Desktop.
Save gdyr/a5ff97ae07ceab71111a8c334c36b8f1 to your computer and use it in GitHub Desktop.
Replay of GAL hits
#define MX 2
#define A0 3
#define A1 4
#define RW 6
#define A2 7
#define A3 8
#define AL 9
#define DC 11
#define DS 12
#define NUM_FUZZ_PINS 9
int fuzz_pins[] = { MX, A0, A1, RW, A2, A3, AL, DC, DS };
int circBuffer[NUM_FUZZ_PINS][10] = {
{ 1,1,1,0,1,0,1,1,1,1 },
{ 1,1,1,0,1,1,1,1,1,0 },
{ 0,0,0,0,1,0,0,0,1,1 },
{ 1,1,0,1,1,1,0,0,0,0 },
{ 0,1,0,0,0,0,1,0,1,1 },
{ 1,0,1,1,0,1,1,0,0,0 },
{ 0,0,1,0,1,1,1,0,0,0 },
{ 0,0,0,1,0,0,1,1,1,1 },
{ 1,0,1,1,0,1,1,1,0,1 }
};
void setup() {
Serial.begin(9600);
for(int i = 0; i < NUM_FUZZ_PINS; i++) {
pinMode(fuzz_pins[i], OUTPUT);
digitalWrite(fuzz_pins[i], LOW);
}
pinMode(5, INPUT);
digitalWrite(5, LOW);
Serial.println("Initialised.");
}
boolean hit = false;
void loop() {
// Hone in on t=5 to t=6 (where we get a hit)
for(int t = 5; t < 7; t++) {
for(int p = 0; p < NUM_FUZZ_PINS; p++) {
digitalWrite(fuzz_pins[p], circBuffer[p][t]);
Serial.print("pin ");
Serial.print(p);
Serial.print(" @ ");
Serial.println(circBuffer[p][t]);
if(digitalRead(5) != 0) {
if(!hit) {
hit = true;
Serial.print("hit! ");
Serial.print(t);
Serial.print(" ");
Serial.println(p);
delay(10000);
}
} else {
hit = false;
}
delay(5);
}
}
Serial.println("loop");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment