Skip to content

Commit

Permalink
remapped pins for pico pi
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bryan committed Aug 6, 2022
1 parent a7cc095 commit 0ab9bba
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 56 deletions.
72 changes: 41 additions & 31 deletions Adafruit-M0-Glitch/Adafruit-M0-Glitch.ino
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@

int Reset = 2;
int GREEN_LED = 0;
int RED_LED = 1;

int GREENLED = 0;
int REDLED = 1;
int Reset = 5;
int GLITCH_SIG = 6;

void setup() {
// put your setup code here, to run once:
digitalWrite(Reset, HIGH);
delay(200);
pinMode(Reset, OUTPUT);
Serial.begin(115200); // open the serial port at 115200
Serial.print("Serial port setup\n");
digitalWrite(Reset, HIGH);
pinMode(Reset, OUTPUT);
digitalWrite(Reset, HIGH);

pinMode(LED_BUILTIN, OUTPUT);
pinMode(GREENLED, OUTPUT);
pinMode(REDLED, OUTPUT);

digitalWrite(LED_BUILTIN, HIGH);
pinMode(GREEN_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
digitalWrite(GREEN_LED, HIGH);
digitalWrite(GREENLED, HIGH);

delay(1000);

digitalWrite(LED_BUILTIN, LOW);
digitalWrite(GREEN_LED, LOW);
digitalWrite(RED_LED, HIGH);
digitalWrite(GREENLED, LOW);
digitalWrite(REDLED, HIGH);

pinMode(GLITCH_SIG, OUTPUT);
digitalWrite(GLITCH_SIG, LOW);
}

void loop()
Expand All @@ -27,11 +36,7 @@ void loop()
#define OUTER_LOOP_CNT 1000
#define INNER_LOOP_CNT 1000

//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
Serial.print("Booting into for loop...\n");
Serial.print("Booting into for loop...\n");

digitalWrite(LED_BUILTIN, LOW);
volatile uint32_t i, j;
Expand All @@ -40,8 +45,9 @@ Serial.print("Booting into for loop...\n");
uint32_t b = 0;
uint32_t run_cnt = 0;
uint32_t glitch_cnt = 0;
//Serial.print("\nCONNECTED 115200\n");
//Serial.print("W. O. P. R. Login: \n");
//Serial.print("\nCONNECTED 115200\n");
//Serial.print("W. O. P. R. Login: \n");

for (run_cnt = 0; run_cnt < RUN_CNT; run_cnt++) {
//Serial.print("starting loop...");
//Serial.println(run_cnt);
Expand All @@ -57,6 +63,7 @@ Serial.print("Booting into for loop...\n");
digitalWrite(13, LOW);
delay(500);
blink_status ^= 1;*/

cnt = 0;
for ( i = 0; i < OUTER_LOOP_CNT; i++) {
for ( j = 0; j < INNER_LOOP_CNT; j++) {
Expand All @@ -75,25 +82,28 @@ Serial.print("Booting into for loop...\n");
if (i != OUTER_LOOP_CNT || j != INNER_LOOP_CNT ||
cnt != (OUTER_LOOP_CNT * INNER_LOOP_CNT) ) {
/*Serial.print("GEETINGS PROFESSOR FALKEN.\n");
Serial.print("\n");
Serial.print("HOW ARE YOU FEELING TODAY?\n");*/
Serial.print("Glitched!\n");
digitalWrite(RED_LED, LOW);
Serial.print("\n");
Serial.print("HOW ARE YOU FEELING TODAY?\n");*/
//Serial.print("Glitched!\n");
digitalWrite(REDLED, LOW);
//if glitched, reset the run count and blink the fault LED
for( b = 0 ; b < 16; b++)
digitalWrite(GLITCH_SIG, HIGH);
for ( b = 0 ; b < 10; b++)
{
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(GREEN_LED, HIGH);
delay(300);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(GREEN_LED, LOW);
delay(300);
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(GREENLED, HIGH);
delay(300);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(GREENLED, LOW);
delay(300);
}
run_cnt = 0;
digitalWrite(Reset, LOW);
digitalWrite(RED_LED, HIGH);
digitalWrite(REDLED, HIGH);
delay(100);
digitalWrite(GLITCH_SIG, LOW);
digitalWrite(Reset, LOW);
digitalWrite(Reset, HIGH);

}
}
}
13 changes: 10 additions & 3 deletions Adafruit-Trinket-M0-Glitch/Adafruit-Trinket-M0-Glitch.ino
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@

int Reset = 2;

int GREEN_LED = 0;
int RED_LED = 1;
int Reset = 2;
int GLITCH_SIG = 3;

void setup() {
// put your setup code here, to run once:
digitalWrite(Reset, HIGH);
delay(200);
pinMode(Reset, OUTPUT);
pinMode(GLITCH_SIG, OUTPUT);
digitalWrite(GLITCH_SIG, LOW);
Serial.begin(115200); // open the serial port at 115200
Serial.print("Serial port setup\n");

pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
pinMode(GREEN_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);

digitalWrite(GREEN_LED, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
Expand Down Expand Up @@ -83,6 +89,7 @@ void loop()
Serial.print("HOW ARE YOU FEELING TODAY?\n");*/
Serial.print("Glitched!\n");
digitalWrite(RED_LED, LOW);
digitalWrite(GLITCH_SIG, LOW);
//if glitched, reset the run count and blink the fault LED
for ( b = 0 ; b < 16; b++)
{
Expand All @@ -94,10 +101,10 @@ void loop()
delay(300);
}
run_cnt = 0;
digitalWrite(Reset, LOW);

digitalWrite(RED_LED, HIGH);
delay(100);
digitalWrite(Reset, HIGH);
digitalWrite(Reset, LOW);
}
}
}
54 changes: 32 additions & 22 deletions RP2040-Glitch/RP2040-Glitch.ino
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@

int Reset = D2;

int GREEN_LED = D0;
int RED_LED = D1;
int Reset = D9;
int GLITCH_SIG = D10;
int b = 0;

void setup() {
// put your setup code here, to run once:
digitalWrite(Reset, HIGH);
delay(200);
pinMode(Reset, OUTPUT);
delay(200);
pinMode(Reset, OUTPUT);
digitalWrite(Reset, HIGH);

pinMode(GLITCH_SIG, OUTPUT);
digitalWrite(GLITCH_SIG, LOW);

Serial.begin(115200); // open the serial port at 115200
Serial.print("Serial port setup\n");

pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
pinMode(GREEN_LED, OUTPUT);
Expand All @@ -23,15 +32,15 @@ void setup() {

void loop()
{
#define RUN_CNT 1000
#define RUN_CNT 5000
#define OUTER_LOOP_CNT 1000
#define INNER_LOOP_CNT 1000

//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
//Serial.print("Booting into for loop...\n");
Serial.print("Booting into for loop...\n");

digitalWrite(LED_BUILTIN, LOW);
volatile uint32_t i, j;
Expand All @@ -40,8 +49,8 @@ Serial.print("Booting into for loop...\n");
uint32_t b = 0;
uint32_t run_cnt = 0;
uint32_t glitch_cnt = 0;
//Serial.print("\nCONNECTED 115200\n");
//Serial.print("W. O. P. R. Login: \n");
//Serial.print("\nCONNECTED 115200\n");
//Serial.print("W. O. P. R. Login: \n");
for (run_cnt = 0; run_cnt < RUN_CNT; run_cnt++) {
//Serial.print("starting loop...");
//Serial.println(run_cnt);
Expand Down Expand Up @@ -75,25 +84,26 @@ Serial.print("Booting into for loop...\n");
if (i != OUTER_LOOP_CNT || j != INNER_LOOP_CNT ||
cnt != (OUTER_LOOP_CNT * INNER_LOOP_CNT) ) {
/*Serial.print("GEETINGS PROFESSOR FALKEN.\n");
Serial.print("\n");
Serial.print("HOW ARE YOU FEELING TODAY?\n");*/
Serial.print("\n");
Serial.print("HOW ARE YOU FEELING TODAY?\n");*/
Serial.print("Glitched!\n");
digitalWrite(RED_LED, LOW);
digitalWrite(GLITCH_SIG, HIGH);
//if glitched, reset the run count and blink the fault LED
for( b = 0 ; b < 16; b++)
for ( b = 0 ; b < 16; b++)
{
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(GREEN_LED, HIGH);
delay(300);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(GREEN_LED, LOW);
delay(300);
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(GREEN_LED, HIGH);
delay(400);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(GREEN_LED, LOW);
delay(400);
}
run_cnt = 0;
digitalWrite(Reset, LOW);
digitalWrite(GLITCH_SIG, LOW);
digitalWrite(RED_LED, HIGH);
delay(100);
digitalWrite(Reset, HIGH);
//digitalWrite(Reset, LOW);
}
}
}

0 comments on commit 0ab9bba

Please sign in to comment.