Question on how to nest an if statement set

self taught too..
new here but been coding for some time now..

wish debugging was easier..
you could use a serial.println(myvar); here and there to try to pinpoint what's going on, slap a big delay(2000); in there too in case your serial monitor is busy..
don't think the and did anything.. if both sides of an or are true then it executes.. the only time an or doesn't execute is when both sides are false..
google logic truth tables, i do all the time.. :slight_smile:
let me know if you get stuck..
have fun.. ~q

OK, still wrapping my head around the whole cse setup.

I have to enumerate the cases as global statements.

Set the switch state as a globals unsigned character. Set that global default value to initiate the first case statement to start the loop.

The completion of one case changes the state to initiate the next case.

So all that said I, "think" this structure might work:
switch (barstate)
case bar1test
case bar1passed
case bar2test
case bar2passed
case bar3test
case bar3passed

OK been doing some toying so I can get some code to play with:


enum {initial, bar1test, bar1passed, bar2test, bar2passed, bar3test, bar3passed, gamewon, gamelost};
unsigned char barstate = initial;  
  rangelow = center - g1low;
  rangehigh = center + g1high;
pinMode(3, INPUT); digitalWrite(3, LOW); 

switch (barstate) 
  case initial;
    if (rangelow < analogRead(A0) &&  analogRead(A0) < rangehigh) { game2(); break;}
    else { game1(); break;   }
  case bar1test:
    if (value2 == 1 ) { bar1(); break; }
    else { bar1(); if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) < 440) { passedbar1(); barstate = bar1passed; break; }}
    if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) { bar1(); detect++; break; }
    if (value2 == 0 && analogRead(A1) < 220) { detect++; }
  case bar1passed:
    if (value2 == 1 ) { bar1passed(); bar2(); barstate=bar2test; break; }
  case bar2test:
    if (value2 == 1 ) { bar1passed(); bar2(); break; }
    if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) { bar1passed(); bar2(); detect++; break; }
    else { bar1passed(); bar2(); if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) < 440) { passedbar2(); barstate = bar2passed; break; }}
  case bar2passed:
    if (value2 == 1 ) { bar1passed(); bar2passed(); bar3(); barstate=bar3test; break; }
  case bar3test:
    if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) { detect++; break; }
    if (value2 == 1 ) { bar1passed(); bar2passed(); bar3(); break; }
    if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) { bar1passed(); bar2passed(); bar3(); detect++; break; } 
  case bar3passed:
    if (value2 == 1 ) { bar1passed(); bar2passed(); bar3passed(); barstate=gamewon; break; }
  case gamewon:
    accessgranted();
    delay(1500);
    gamewon();
    delay(2000);
    pinMode(3, OUTPUT); //reset unit
  case gamelost:

This kind of formatting is extremely bad form. Only in very unusual circumstances should you put multiple statements on one line. At least, in any public code.

Is 'value2' a boolean? Then declare it as 'bool', only assign 'true' or 'false' to it, and give it a non-generic name so the reader can instantly know what it is used for.

How can 'bar1passed' be both an enum value and a function?

enum {initial, bar1test, bar1passed, ...

Notice if (value2 == 0 && analogRead(A1) < 220) { detect++; } and how it is missing a break?

No default case? What happens when barstate is 140097 or -1? If something happens that causes barstate to be a bad guy then a default in the case would be there to catch such an occurrence; an opinion.

I did it based on this tutorial on THIS forum:
State machines - Using Arduino / Introductory Tutorials - Arduino Forum
If you have issues with the example address that with the mods, not me.

If you got a better example I can base things off of I am all ears. Finding good base nomenclature is a bit vexing at times.

And yes I did forget the default case. I will fix that as your point is valid.

I prefer to group things on one line when I am doing things as it makes it so I do not have to scroll. when I am trying to make sure I am not missing anything.

 if (value2 == 1 ) { bar1passed(); bar2passed(); bar3(); barstate=bar3test; break; }
// this rerenders based on button presses
  debouncer1.update(); debouncer2.update(); int value1 = debouncer1.read(); int value2 = debouncer2.read();

value2 is a integer value. it is either 0 or 1. and is a compenent piece of usage of the bounce2.h library. bounce2.h is one of THE best debounce libraries I have found for arduino so far and is a stable of my stuff since I found it.

'value2' is not used as an integer value at all in your program. It could be, since you declared it as an 'int' type. In your program, it's used as a boolean value, so the sensible thing to do is treat it as a logical, boolean value with non-numeric values 'true' and 'false'.

If you really like the library so much, you should follow its example and use boolean values, because that is what the library uses. Observe that the return value for the 'read()' calls you are making, is boolean. Here is the function declaration from the library. You should take a closer look at the library and its examples.

     @return HIGH or LOW.
     */
	bool read() const;

In the Arduino environment, there is a special data type for pin states but it's mostly unused. However, it's common practice to use HIGH in place of 'true' and LOW in place of 'false', for the sake of simplicity. This is much less confusing than using integers and constant numbers 0 and 1.

The value piece works. The button read pieces work for me. The only issue I am having at this point is with a logic piece on the bars which I am working through.

Those are your constraints and choices. Unfortunately, you are asking for help which involves the constraints and choices of other people. The more they know, the more helpful they can be, but also the more they will want you to change your habits to make it easier for them, not the other way around.

Because of that, if you don't change tack, the probable outcome of this thread will be that you will have to abandon it and solve the problem alone.

1 Like

The moderators don't adjudicate code quality. Also there are none of the problems I mentioned, in that sketch.

OK, I was busy getting the hardware prototype built. It works fine with an older version of the code sans the state machine piece. Also integrated the hardware for my motion tracker as well.

I will shoot a picture of what that looks like to help

I got the state machine to compile and somewhat run now I just have to sort out the logic and build out the other functions that the state machine references.

/*Libraries provided by adafruit written by Lady Ada Fried.
 *Please stick to adafruit products as chinese knock offs are very,
 *very, very, very, very, very problematic.
 * code for bar courtesy of:
 * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189
 * some code pulled from isolation motion tracker pulled from:
 * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M
 * help found on arduino forums at https://arduino.cc
 */
// Include the Bounce2 library found here :
// https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>
#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <LcdProgressBar.h>
#include <LiquidCrystal.h>

// For the Adafruit shield, these are the default.
//#define TFT_MISO 8
#define TFT_DC 9
#define TFT_CS 10
//#define TFT_MOSI 11
//#define TFT_CLK 12


// the colors are in a RGB565 format, so to get it you first need to grab it as a RGB888 and convert
//go here
//https://imagecolorpicker.com/en
//then here
//http://www.barth-dev.de/online/rgb565-color-picker/
// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define DARKGREEN 0x03E0
#define OLIVE 0x7BE0
#define GREENYELLOW 0xAFE5
#define TEAL 0x263F
// button pins
//22 is a4, 23 is a5 on micro.
#define BUTTON_PIN_1 A5
#define BUTTON_PIN_2 A4
// pot pins are pins 14(a0) and 15(a1)
Bounce debouncer1 = Bounce();
Bounce debouncer2 = Bounce();
enum { initial,
       bar1test,
       bar1passed1,
       bar2test,
       bar2passed1,
       bar3test,
       bar3passed1,
       gamewon,
       gamelost };
unsigned char barstate = bar1test;


//global integer declarations
// arguments exist against global variables, however, they are nice if you use integers across functions
int rangelow;
int rangehigh;
int g1low = 80;
int g1high = 80;
int center;
int detect = 0;
int render = 0;
int b1 = 0;
int b2 = 0;
//int myWidth;
//int myHeight;
//invokation for the adafruit TFT
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);  //, TFT_MOSI, TFT_CLK, TFT_MISO);

void setup() {
  pinMode(3, INPUT);
  digitalWrite(3, LOW);
  pinMode(A0, INPUT);
  tft.begin();
  tft.fillScreen(BLACK);
  tft.setRotation(1);  //this sets 0,0 as the top left corner
                       //  txt(); //used to import screen settings from motion tracker code
  boot1();
  boot2();
  tft.fillScreen(BLACK);
  tft.setRotation(1);
  // button initialization
  pinMode(BUTTON_PIN_1, INPUT_PULLUP);
  debouncer1.attach(BUTTON_PIN_1);
  debouncer1.interval(5);
  pinMode(BUTTON_PIN_2, INPUT_PULLUP);
  debouncer2.attach(BUTTON_PIN_2);
  debouncer2.interval(25);
  // sets up random number generator for game1 to game 2 transition
  randomSeed(analogRead(A3));
  center = random(150, 950);
  //  int myHeight = tft.height();
  //int myWidth = tft.width();
}

void loop() {
  rangelow = center - g1low;
  rangehigh = center + g1high;
  // comment out the bottom two lines and replace them with the below line to aid in calibrating your setup
  // calibration();
  if (rangelow < analogRead(A0) && analogRead(A0) < rangehigh) {
    game2();
  } else {
    game1();
  }  //tft.fillRect(230, 40, 20, 20, BLACK);}
     // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  delay(20);
}

void calibration() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int bar = map(analogRead(A0), 0, 1023, 0, 308);
  tft.fillRect(6, 80, bar, 44, RED);
  tft.fillRect(bar, 80, 308 - bar, 44, BLACK);
  tft.fillRect(0, 20, myWidth, 5, BLACK);
  // draws pot number reading
  tft.setCursor(80, 40);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(analogRead(A0));
  // draws pot 2 number reading
  tft.setCursor(160, 40);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(analogRead(A1));
  // clears button status
  tft.fillRect(80, 140, 100, 30, BLACK);
  tft.fillRect(80, 180, 100, 30, BLACK);
  // add rendering pause
  delay(100);
  // clears drawings
  tft.fillRect(bar, 20, 20, 5, WHITE);
  tft.fillRect(80, 40, 200, 30, BLACK);
  game1();
  //math for range sweetspot logic
  rangelow = center - g1low;
  rangehigh = center + g1high;
  if (rangelow < analogRead(A0) && analogRead(A0) < rangehigh) {
    tft.fillRect(230, 40, 20, 20, OLIVE);
  } else {
    tft.fillRect(230, 40, 20, 20, BLACK);
  }
  // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  // draws button 2 status
  tft.setCursor(160, 140);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(value2);
  // draws button 1 status
  tft.setCursor(80, 140);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(value1);
  // draws pot 2 status
  tft.setCursor(160, 180);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(rangelow);
  // draws pot 1 status
  tft.setCursor(80, 180);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(rangehigh);
  // clears text
}

void txt() {  //Starting :)
  tft.fillScreen(BLACK);
  tft.setCursor(60, 20);
  tft.setTextColor(WHITE);
  tft.setTextSize(5);
  tft.println("B2-LAB");
  tft.setCursor(20, 80);
  tft.setTextColor(GREEN);
  tft.setTextSize(3);
  tft.println("MOTION-TRACKER");
  tft.setCursor(10, 130);
  tft.setTextColor(RED);
  tft.setTextSize(2);
  tft.println("^VERTICAL WHEN OPERATING^");
  tft.setCursor(60, 150);
  tft.setTextColor(GREEN);
  tft.setTextSize(2);
  tft.print("Calibrate Sensors");
  tft.setCursor(10, 170);
  tft.setTextSize(3);
  for (int i = 0; i < 4; i++) {
    tft.print(".");
    delay(500);
  }
}

void boot1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  byte progress = myWidth / 8;
  int progress1;
  tft.fillScreen(BLACK);
  tft.setCursor(30, 10);
  tft.setTextColor(GREEN);
  tft.setTextSize(6);
  tft.println("SEEGSON");
  tft.drawRect(myWidth * 2 / 16, myHeight * 3 / 5, myWidth * 12 / 16 - 5, 50, GREEN);
  for (int i = 0; i < 40; i++) {
    tft.fillRect(myWidth * 2 / 16, myHeight * 3 / 5, progress, 50, GREEN);
    tft.setTextSize(2);
    tft.setCursor(myWidth * 4 / 16, myHeight * 5 / 12);
    tft.print("Progress  ");
    tft.setTextSize(2);
    tft.setCursor(myWidth * 5 / 8, myHeight * 5 / 12);
    progress1 = progress * 17 / 40;
    tft.print(progress1);
    delay(5);
    tft.fillRect(myWidth * 9 / 16, myHeight * 5 / 12, myHeight * 5 / 12, 20, BLACK);
    progress += 5;
  }
}

void boot2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  tft.fillScreen(BLACK);
  tft.setCursor(myWidth * 3 / 16, myHeight * 9 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.print("Please wait");
  tft.drawRect(myWidth / 2, myHeight * 1 / 5, 5, 20, WHITE);
  delay(200);
  tft.drawRect(myWidth / 2, myHeight * 1 / 5, 5, 20, BLACK);
  tft.drawLine(myWidth * 7 / 16, myHeight * 3 / 12, myWidth * 9 / 16, myHeight * 1 / 12, WHITE);
  delay(200);
  tft.drawLine(myWidth * 7 / 16, myHeight * 3 / 12, myWidth * 9 / 16, myHeight * 1 / 12, BLACK);
  tft.drawLine(myWidth * 7 / 16, myHeight * 2 / 12, myWidth * 9 / 16, myHeight * 1 / 12, WHITE);
  delay(200);
  tft.drawLine(myWidth * 7 / 16, myHeight * 2 / 12, myWidth * 9 / 16, 5, BLACK);
}


void game2() {
  // declare variables for function
  int myHeight = tft.height();
  int myWidth = tft.width();
  int estcon;
  int senpak;
  int ovrpak;
  // sets base text for game
  tft.setCursor(myWidth * 3 / 16, myHeight * 1 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("SYSTEM OVERRIDE");
  tft.setCursor(myWidth * 4 / 16 - 10, myHeight * 11 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("SECURITY FREQUENCY MATCH");
  tft.setCursor(myWidth * 4 / 16, myHeight * 12 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("V2.34 SYSTEM TEST");
  calibrate2();
  // the big minigame border
  tft.drawRect(3, myHeight * 3 / 12, myWidth - 9, myHeight * 6 / 12, WHITE);
  tft.drawRect(6, myHeight * 3 / 12, myWidth - 15, myHeight * 6 / 12, WHITE);
  //  bar1();
  //  bar2();
  //bar3();

  int pass1;
  // this rerenders based on button presses
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();

  switch (barstate) {
    case bar1test:
      if (value2 == 1) {
        bar1();
        break;
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) < 440) {
        passedbar1();
        barstate = bar1passed1;
        break;
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) {
        bar1();
        detect++;
        break;
      }
      //      if (value2 == 0 && analogRead(A1) < 220) { detect++; }
      break;
    case bar1passed1:
      if (value2 == 1) {
        passedbar1();
        bar2();
        barstate = bar2test;
      }
      break;
    case bar2test:
      if (value2 == 1) {
        passedbar1();
        bar2();
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) {
        passedbar1();
        bar2();
        detect++;
      } else {
        passedbar1();
        bar2();
        if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) < 440) {
          passedbar2();
          barstate = bar2passed1;
        }
      }
      break;
    case bar2passed1:
      if (value2 == 1) {
        passedbar1();
        passedbar2();
        bar3();
        barstate = bar3test;
        break;
      }
    case bar3test:
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) { detect++; }
      if (value2 == 1) {
        passedbar1();
        passedbar2();
        bar3();
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) {
        passedbar1();
        passedbar2();
        bar3();
        detect++;
      }
      break;
    case bar3passed1:
      if (value2 == 1) {
        passedbar1();
        passedbar2();
        passedbar3();
        barstate = gamewon;
      }
      break;
    case gamewon:
      accessgranted();
      delay(1500);
      gamewon1();
      delay(2000);
      pinMode(3, OUTPUT);  //reset unit
      break;
    case gamelost:
      gamelost1();
      break;
      break;
  }

  // this is a rerender section
  if (value1 == 0) { b1++; }
  if (b1 == 5) {
    tft.fillScreen(TEAL);
    b1++;
  }
  if (b1 == 7) { b1 = 0; }  //

  //  This delays the redrawing of the entire screen
  render++;
  delay(10);
  if (render == 2) {
    tft.fillScreen(TEAL);
    render++;
  }
  if (render == 70) { render = 0; }
  // rerender pieces set after delay
}

void game1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  // this is a delayed screen rerender
  int render1;
  render1++;
  delay(10);
  if (render1 == 2) {
    tft.fillScreen(BLACK);
    render1++;
  }
  if (render1 == 40) { render1 = 0; }
  //I ended up having to separate out remaps for each side of the slider bar

  int bordw = map(analogRead(A0), 0, 1023, 0, 1023);
  int bordt = map(analogRead(A0), 0, 256, 0, myWidth);
  int bordrh = map(analogRead(A0), 256, 512, 0, myHeight);
  int bordb = map(analogRead(A0), 512, 768, myWidth, 0);
  int bordlh = map(analogRead(A0), 768, 1023, myHeight, 0);
  tft.fillRect(bordt, 0, 20, 5, WHITE);
  tft.fillRect(myWidth - 5, bordrh, 5, 20, WHITE);
  tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE);
  tft.fillRect(0, bordlh, 5, 20, WHITE);
  delay(10);
  tft.fillRect(0, 0, 5, myHeight, BLACK);
  tft.fillRect(0, 0, myWidth, 5, BLACK);
  tft.fillRect(myWidth - 5, 0, 5, myHeight, BLACK);
  tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK);
  // center box
  // yellow border
  tft.drawRect(myWidth * 2 / 16 - 8, myHeight * 4 / 12, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 7, myHeight * 4 / 12 - 1, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 6, myHeight * 4 / 12 - 2, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 5, myHeight * 4 / 12 - 3, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 4, myHeight * 4 / 12 - 4, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 3, myHeight * 4 / 12 - 5, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  // text segments
  tft.setCursor(myWidth * 2 / 16, myHeight * 5 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("INCORRECT CODE");
  tft.setCursor(myWidth * 2 / 16, myHeight * 7 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("SYSTEM DETECTIONS");
  tft.setCursor(myWidth * 13 / 16, myHeight * 7 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print(detect);
  tft.setCursor(myWidth * 13 / 16 + 12, myHeight * 7 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("/3");
}

void bar1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int estcon;
  // bar 1 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 3 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Establishing Connection");
  estcon = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(estcon, myHeight * 4 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 4 / 12, estcon - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(estcon + 12, myHeight * 4 / 12, myWidth - estcon - 30, 15, TEAL);
  // these are the static vertical lines on the bar
  tft.drawRect(9, myHeight * 4 / 12, myWidth - 30, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 4 / 12, 30, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 7 / 16, myHeight * 4 / 12, 4, 15, WHITE);
}
void bar2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int senpak;
  // bar 2 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 5 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Sending Packets");
  senpak = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(senpak, myHeight * 6 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 6 / 12, senpak - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(senpak + 12, myHeight * 6 / 12, myWidth - senpak - 30, 15, TEAL);
  // draws lines
  tft.drawRect(9, myHeight * 6 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
}
void bar3() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int ovrpak;
  //bar 3
  tft.setCursor(20, myHeight * 7 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Overriding Protocol");
  ovrpak = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(ovrpak, myHeight * 8 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 8 / 12, ovrpak - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(ovrpak + 12, myHeight * 8 / 12, myWidth - ovrpak - 30, 15, TEAL);
  // draws lines
  tft.drawRect(9, myHeight * 8 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
}
void calibrate2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  // calibration testing
  tft.setCursor(myWidth * 4 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.println(analogRead(A1));
  // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  // draws button 2 status
  tft.setCursor(myWidth * 6 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(RED);
  tft.setTextSize(1);
  tft.println(value2);
  // draws button 1 status
  tft.setCursor(myWidth * 8 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(OLIVE);
  tft.setTextSize(1);
  tft.println(value1);
  delay(10);
  tft.fillRect(myWidth * 4 / 16, myHeight * 10 / 12 - 10, 100, 20, TEAL);
  // end calibration testing section
}

void passedbar1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  // renders static bar once bar 1 passed checks
  tft.setCursor(20, myHeight * 3 / 12 + 5);
  tft.drawRect(20, myHeight * 3 / 12 + 5, 200, 15, TEAL);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Established Connection");
  tft.drawRect(9, myHeight * 4 / 12, myWidth - 30, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 4 / 12, 30, 15, WHITE);
  tft.drawLine(myWidth - 50, myHeight * 4 / 12, myWidth - 35, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 49, myHeight * 4 / 12, myWidth - 34, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 48, myHeight * 4 / 12, myWidth - 33, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 47, myHeight * 4 / 12, myWidth - 32, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 35, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 10, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 34, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 9, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 33, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 8, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 32, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 7, myHeight * 3 / 12, GREEN);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 7 / 16, myHeight * 4 / 12, 4, 15, WHITE);
}
void passedbar2() {}
void passedbar3() {}
void accessgranted() {}
void gamelost1() {}
void gamewon1() {}

As folks have requested here is the breakdown of the switch case in the form you all are asking for

  switch (barstate) {
    case bar1test:
      if (value2 == 1) {
        bar1();
        break;
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) < 440) {
        passedbar1();
        barstate = bar1passed1;
        break;
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) {
        bar1();
        detect++;
        break;
      }
      //      if (value2 == 0 && analogRead(A1) < 220) { detect++; }
      break;
    case bar1passed1:
      if (value2 == 1) {
        passedbar1();
        bar2();
        barstate = bar2test;
      }
      break;
    case bar2test:
      if (value2 == 1) {
        passedbar1();
        bar2();
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) {
        passedbar1();
        bar2();
        detect++;
      } else {
        passedbar1();
        bar2();
        if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) < 440) {
          passedbar2();
          barstate = bar2passed1;
        }
      }
      break;
    case bar2passed1:
      if (value2 == 1) {
        passedbar1();
        passedbar2();
        bar3();
        barstate = bar3test;
        break;
      }
    case bar3test:
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) 
        { detect++; 
        }
      if (value2 == 1) {
        passedbar1();
        passedbar2();
        bar3();
      }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) {
        passedbar1();
        passedbar2();
        bar3();
        detect++;
      }
      break;
    case bar3passed1:
      if (value2 == 1) {
        passedbar1();
        passedbar2();
        passedbar3();
        barstate = gamewon;
      }
      break;
    case gamewon:
      accessgranted();
      delay(1500);
      gamewon1();
      delay(2000);
      pinMode(3, OUTPUT);  //reset unit
      break;
    case gamelost:
      gamelost1();
      break;
    break;
  }

Pictures as stated

I got the logic figured out. I had a typo or math error

 if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) < 440) {
        passedbar1();
        barstate = bar1passed1;
        break;
        }

The "220 > analogRead(A1)" should have had a "<" instead of a ">."

basically the error on my part was the way it was working for all conditions to count as true would never happen as it had to be smaller than 220 and smaller than 440. The desire was to have it be between the values.

The logic. Other than the gamelost screen this is done minus screen finetuning

/*Libraries provided by adafruit written by Lady Ada Fried.
 *Please stick to adafruit products as chinese knock offs are very,
 *very, very, very, very, very problematic.
 * code for bar courtesy of:
 * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189
 * some code pulled from isolation motion tracker pulled from:
 * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M
 * help found on arduino forums at https://arduino.cc
 */
// Include the Bounce2 library found here :
// https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>
#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <LcdProgressBar.h>
#include <LiquidCrystal.h>

// For the Adafruit shield, these are the default.
// USE hardware SPI pins. 
#define TFT_DC 9
#define TFT_CS 10
// the colors are in a RGB565 format, so to get it you first need to grab it as a RGB888 and convert
//go here
//https://imagecolorpicker.com/en
//then here
//http://www.barth-dev.de/online/rgb565-color-picker/
// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define DARKGREEN 0x03E0
#define OLIVE 0x7BE0
#define GREENYELLOW 0xAFE5
#define TEAL 0x263F
// button pins
//22 is a4, 23 is a5 on micro.
#define BUTTON_PIN_1 A5
#define BUTTON_PIN_2 A4
// pot pins are pins 14(a0) and 15(a1)
Bounce debouncer1 = Bounce(); Bounce debouncer2 = Bounce();
enum { initial, bar1test, bar1passed1, bar2test, bar2passed1, bar3test, bar3passed1, gamewon, gamelost };
unsigned char barstate = bar1test;
//global integer declarations
// arguments exist against global variables, however, they are nice if you use integers across functions
int rangelow;
int rangehigh;
int g1low = 80;
int g1high = 80;
int center;
int detect = 0;
int render = 0;
int b1 = 0;
int b2 = 0;

//invokation for the adafruit TFT
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);  //, TFT_MOSI, TFT_CLK, TFT_MISO);

void setup() {
  pinMode(3, INPUT);
  digitalWrite(3, LOW);
  pinMode(A0, INPUT);
  tft.begin();
  tft.fillScreen(BLACK);
  tft.setRotation(1);  //this sets 0,0 as the top left corner
                       //  txt(); //used to import screen settings from motion tracker code
  boot1();
  boot2();
  tft.fillScreen(BLACK);
  tft.setRotation(1);
  // button initialization
  pinMode(BUTTON_PIN_1, INPUT_PULLUP);
  debouncer1.attach(BUTTON_PIN_1);
  debouncer1.interval(5);
  pinMode(BUTTON_PIN_2, INPUT_PULLUP);
  debouncer2.attach(BUTTON_PIN_2);
  debouncer2.interval(25);
  // sets up random number generator for game1 to game 2 transition
  randomSeed(analogRead(A3));
  center = random(150, 950);
  //  int myHeight = tft.height();
  //int myWidth = tft.width();
}

void loop() {
  rangelow = center - g1low;
  rangehigh = center + g1high;
  // comment out the bottom two lines and replace them with the below line to aid in calibrating your setup
  // calibration();
  if (rangelow < analogRead(A0) && analogRead(A0) < rangehigh) {

    game2();
 
    }
      else {
   
        game1();
   
        }  //tft.fillRect(230, 40, 20, 20, BLACK);}
     // declarations for buttons
  debouncer1.update(); debouncer2.update(); int value1 = debouncer1.read(); int value2 = debouncer2.read();
  delay(20);
}

void calibration() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int bar = map(analogRead(A0), 0, 1023, 0, 308);
  tft.fillRect(6, 80, bar, 44, RED);
  tft.fillRect(bar, 80, 308 - bar, 44, BLACK);
  tft.fillRect(0, 20, myWidth, 5, BLACK);
  // draws pot number reading
  tft.setCursor(80, 40);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(analogRead(A0));
  // draws pot 2 number reading
  tft.setCursor(160, 40);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(analogRead(A1));
  // clears button status
  tft.fillRect(80, 140, 100, 30, BLACK);
  tft.fillRect(80, 180, 100, 30, BLACK);
  // add rendering pause
  delay(100);
  // clears drawings
  tft.fillRect(bar, 20, 20, 5, WHITE);
  tft.fillRect(80, 40, 200, 30, BLACK);
  game1();
  //math for range sweetspot logic
  rangelow = center - g1low;
  rangehigh = center + g1high;
  if (rangelow < analogRead(A0) && analogRead(A0) < rangehigh) {
    tft.fillRect(230, 40, 20, 20, OLIVE);
  } else {
    tft.fillRect(230, 40, 20, 20, BLACK);
  }
  // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  // draws button 2 status
  tft.setCursor(160, 140);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(value2);
  // draws button 1 status
  tft.setCursor(80, 140);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(value1);
  // draws pot 2 status
  tft.setCursor(160, 180);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(rangelow);
  // draws pot 1 status
  tft.setCursor(80, 180);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(rangehigh);
  // clears text
}

void txt() {  //Starting :)
  tft.fillScreen(BLACK);
  tft.setCursor(60, 20);
  tft.setTextColor(WHITE);
  tft.setTextSize(5);
  tft.println("B2-LAB");
  tft.setCursor(20, 80);
  tft.setTextColor(GREEN);
  tft.setTextSize(3);
  tft.println("MOTION-TRACKER");
  tft.setCursor(10, 130);
  tft.setTextColor(RED);
  tft.setTextSize(2);
  tft.println("^VERTICAL WHEN OPERATING^");
  tft.setCursor(60, 150);
  tft.setTextColor(GREEN);
  tft.setTextSize(2);
  tft.print("Calibrate Sensors");
  tft.setCursor(10, 170);
  tft.setTextSize(3);
  for (int i = 0; i < 4; i++) {
    tft.print(".");
    delay(500);
  }
}

void boot1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  byte progress = myWidth / 8;
  int progress1;
  tft.fillScreen(BLACK);
  tft.setCursor(30, 10);
  tft.setTextColor(GREEN);
  tft.setTextSize(6);
  tft.println("SEEGSON");
  tft.drawRect(myWidth * 2 / 16, myHeight * 3 / 5, myWidth * 12 / 16 - 5, 50, GREEN);
  for (int i = 0; i < 40; i++) {
    tft.fillRect(myWidth * 2 / 16, myHeight * 3 / 5, progress, 50, GREEN);
    tft.setTextSize(2);
    tft.setCursor(myWidth * 4 / 16, myHeight * 5 / 12);
    tft.print("Progress  ");
    tft.setTextSize(2);
    tft.setCursor(myWidth * 5 / 8, myHeight * 5 / 12);
    progress1 = progress * 17 / 40;
    tft.print(progress1);
    delay(5);
    tft.fillRect(myWidth * 9 / 16, myHeight * 5 / 12, myHeight * 5 / 12, 20, BLACK);
    progress += 5;
  }
}

void boot2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  tft.fillScreen(BLACK);
  tft.setCursor(myWidth * 3 / 16, myHeight * 9 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.print("Please wait");
  tft.drawRect(myWidth / 2, myHeight * 1 / 5, 5, 20, WHITE);
  delay(200);
  tft.drawRect(myWidth / 2, myHeight * 1 / 5, 5, 20, BLACK);
  tft.drawLine(myWidth * 7 / 16, myHeight * 3 / 12, myWidth * 9 / 16, myHeight * 1 / 12, WHITE);
  delay(200);
  tft.drawLine(myWidth * 7 / 16, myHeight * 3 / 12, myWidth * 9 / 16, myHeight * 1 / 12, BLACK);
  tft.drawLine(myWidth * 7 / 16, myHeight * 2 / 12, myWidth * 9 / 16, myHeight * 1 / 12, WHITE);
  delay(200);
  tft.drawLine(myWidth * 7 / 16, myHeight * 2 / 12, myWidth * 9 / 16, 5, BLACK);
}


void game2() {
  // declare variables for function
  int myHeight = tft.height();
  int myWidth = tft.width();
  int estcon;
  int senpak;
  int ovrpak;
  // sets base text for game
  tft.setCursor(myWidth * 3 / 16, myHeight * 1 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("SYSTEM OVERRIDE");
  tft.setCursor(myWidth * 4 / 16 - 10, myHeight * 11 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("SECURITY FREQUENCY MATCH");
  tft.setCursor(myWidth * 4 / 16, myHeight * 12 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("V2.34 SYSTEM TEST");
  calibrate2();
  // the big minigame border
  tft.drawRect(3, myHeight * 3 / 12, myWidth - 9, myHeight * 6 / 12, WHITE);
  tft.drawRect(6, myHeight * 3 / 12, myWidth - 15, myHeight * 6 / 12, WHITE);
  int pass1;
  // this rerenders based on button presses
  debouncer1.update(); debouncer2.update(); int value1 = debouncer1.read(); int value2 = debouncer2.read();
 
  switch (barstate) {
    case bar1test:
      bar1();
      if (value2 == 0 && 220 < analogRead(A1) && analogRead(A1) < 440) { barstate = bar1passed1; break; }
      if (value2 == 0 && 220 > analogRead(A1) && analogRead(A1) > 440) {detect++; break; }
      if (value2 == 0  && detect == 3 ) { barstate = gamelost; break; }     
      break;
    case bar1passed1:
      passedbar1(); bar2(); barstate = bar2test; break;
    case bar2test:
      passedbar1(); bar2();
      if (value2 == 0 && 140 < analogRead(A1) && analogRead(A1) < 280) { barstate = bar2passed1; break; }   
      if (value2 == 0 && 140 > analogRead(A1) && analogRead(A1) > 280) { detect++; break; }
      if (value2 == 0 && detect == 3) { barstate = gamelost; break; }
      break;
    case bar2passed1:
        passedbar1(); passedbar2(); bar3(); barstate = bar3test; break;
    case bar3test:
      passedbar1(); passedbar2(); bar3();
      if (value2 == 0 && 720 > analogRead(A1) && analogRead(A1) > 870) { detect++; break;}     
      if (value2 == 0 && 720 < analogRead(A1) && analogRead(A1) < 870) { barstate = bar3passed1; break; }
      if (value2 == 0 && detect == 3) { barstate = gamelost; break; }
      break;
    case bar3passed1:
        passedbar1(); passedbar2(); passedbar3(); barstate = gamewon; break;
    case gamewon:
      accessgranted();
      delay(2000);
      gamewon1();
      delay(2000);
      pinMode(3, OUTPUT);  //reset unit
      break;
    case gamelost:
      gamelost1();
      break;
  }

  // this is a rerender section
  if (value1 == 0) { b1++; }
  if (b1 == 5) {
    tft.fillScreen(TEAL);
    b1++;
  }
  if (b1 == 7) { b1 = 0; }  //

  //  This delays the redrawing of the entire screen
  render++;
  delay(10);
  if (render == 2) {
    tft.fillScreen(TEAL);
    render++;
  }
  if (render == 70) { render = 0; }
  // rerender pieces set after delay
}

void game1() {
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  int myHeight = tft.height();
  int myWidth = tft.width();
  // this is a delayed screen rerender
  int render1;
  render1++;
  delay(10);
  if (render1 == 2) {
    tft.fillScreen(BLACK);
    render1++;
  }
  if (render1 == 40) { render1 = 0; }
  //I ended up having to separate out remaps for each side of the slider bar

  int bordw = map(analogRead(A0), 0, 1023, 0, 1023);
  int bordt = map(analogRead(A0), 0, 256, 0, myWidth);
  int bordrh = map(analogRead(A0), 256, 512, 0, myHeight);
  int bordb = map(analogRead(A0), 512, 768, myWidth, 0);
  int bordlh = map(analogRead(A0), 768, 1023, myHeight, 0);
  tft.fillRect(bordt, 0, 20, 5, WHITE);
  tft.fillRect(myWidth - 5, bordrh, 5, 20, WHITE);
  tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE);
  tft.fillRect(0, bordlh, 5, 20, WHITE);
  delay(10);
  tft.fillRect(0, 0, 5, myHeight, BLACK);
  tft.fillRect(0, 0, myWidth, 5, BLACK);
  tft.fillRect(myWidth - 5, 0, 5, myHeight, BLACK);
  tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK);
  // center box
  // yellow border
  tft.drawRect(myWidth * 2 / 16 - 8, myHeight * 4 / 12, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 7, myHeight * 4 / 12 - 1, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 6, myHeight * 4 / 12 - 2, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 5, myHeight * 4 / 12 - 3, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 4, myHeight * 4 / 12 - 4, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 3, myHeight * 4 / 12 - 5, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  // text segments
  tft.setCursor(myWidth * 2 / 16, myHeight * 5 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("INCORRECT CODE");
  tft.setCursor(myWidth * 2 / 16, myHeight * 7 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("SYSTEM DETECTIONS");
  tft.setCursor(myWidth * 13 / 16, myHeight * 7 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print(detect);
  tft.setCursor(myWidth * 13 / 16 + 12, myHeight * 7 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("/3");

  // this is a rerender section
  if (value1 == 0) { b1++; }
  if (b1 == 5) {
    tft.fillScreen(BLACK);
    b1++;
  }
  if (b1 == 7) { b1 = 0; }
 
}

void bar1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int estcon;
  // bar 1 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 3 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Establishing Connection");
  estcon = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(estcon, myHeight * 4 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 4 / 12, estcon - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(estcon + 12, myHeight * 4 / 12, myWidth - estcon - 30, 15, TEAL);
  // these are the static vertical lines on the bar
  tft.drawRect(9, myHeight * 4 / 12, myWidth - 30, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 4 / 12, 30, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 7 / 16, myHeight * 4 / 12, 4, 15, WHITE);
}
void bar2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int senpak;
  // bar 2 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 5 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Sending Packets");
  senpak = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(senpak, myHeight * 6 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 6 / 12, senpak - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(senpak + 12, myHeight * 6 / 12, myWidth - senpak - 30, 15, TEAL);
  // draws lines
  tft.drawRect(9, myHeight * 6 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
}
void bar3() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int ovrpak;
  //bar 3
  tft.setCursor(20, myHeight * 7 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Overriding Protocol");
  ovrpak = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(ovrpak, myHeight * 8 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 8 / 12, ovrpak - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(ovrpak + 12, myHeight * 8 / 12, myWidth - ovrpak - 30, 15, TEAL);
  // draws lines
  tft.drawRect(9, myHeight * 8 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
}
void calibrate2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  // calibration testing
  tft.setCursor(myWidth * 4 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.println(analogRead(A1));
  // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  // draws button 2 status
  tft.setCursor(myWidth * 6 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(RED);
  tft.setTextSize(1);
  tft.println(value2);
  // draws button 1 status
  tft.setCursor(myWidth * 8 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(OLIVE);
  tft.setTextSize(1);
  tft.println(value1);
  delay(10);
  tft.fillRect(myWidth * 4 / 16, myHeight * 10 / 12 - 10, 100, 20, TEAL);
  // end calibration testing section
}

void passedbar1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  // renders static bar once bar 1 passed checks
  tft.setCursor(20, myHeight * 3 / 12 + 5);
  tft.drawRect(20, myHeight * 3 / 12 + 5, 200, 15, TEAL);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Established Connection");
  tft.drawRect(9, myHeight * 4 / 12, myWidth - 30, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 4 / 12, 30, 15, WHITE);
  tft.drawLine(myWidth - 50, myHeight * 4 / 12, myWidth - 35, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 49, myHeight * 4 / 12, myWidth - 34, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 48, myHeight * 4 / 12, myWidth - 33, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 47, myHeight * 4 / 12, myWidth - 32, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 35, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 10, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 34, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 9, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 33, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 8, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 32, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 7, myHeight * 3 / 12, GREEN);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 7 / 16, myHeight * 4 / 12, 4, 15, WHITE);
}
void passedbar2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int senpak;
  // bar 2 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 5 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Packet Sent");
  // draws lines
  tft.drawRect(9, myHeight * 6 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 6 / 12, 30, 15, WHITE);
  tft.drawLine(myWidth - 50, myHeight * 6 / 12, myWidth - 35, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 49, myHeight * 6 / 12, myWidth - 34, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 48, myHeight * 6 / 12, myWidth - 33, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 47, myHeight * 6 / 12, myWidth - 32, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 35, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 10, myHeight * 5 / 12, GREEN);
  tft.drawLine(myWidth - 34, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 9, myHeight * 5 / 12, GREEN);
  tft.drawLine(myWidth - 33, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 8, myHeight * 5 / 12, GREEN);
  tft.drawLine(myWidth - 32, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 7, myHeight * 5 / 12, GREEN); 

}
void passedbar3() {
int myHeight = tft.height();
  int myWidth = tft.width();
  int ovrpak;
  //bar 3
  tft.setCursor(20, myHeight * 7 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Protocol Bypassed");

  // draws lines
  tft.drawRect(9, myHeight * 8 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
 
  tft.fillRect(myWidth - 50, myHeight * 8 / 12, 30, 15, WHITE);
  tft.drawLine(myWidth - 50, myHeight * 8 / 12, myWidth - 35, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 49, myHeight * 8 / 12, myWidth - 34, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 48, myHeight * 8 / 12, myWidth - 33, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 47, myHeight * 8 / 12, myWidth - 32, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 35, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 10, myHeight * 7 / 12, GREEN);
  tft.drawLine(myWidth - 34, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 9, myHeight * 7 / 12, GREEN);
  tft.drawLine(myWidth - 33, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 8, myHeight * 7 / 12, GREEN);
  tft.drawLine(myWidth - 32, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 7, myHeight * 7 / 12, GREEN); 
 
}
void accessgranted() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  tft.fillScreen(GREEN);
  // center box
  // yellow border
  tft.drawRect(myWidth * 2 / 16 - 8, myHeight * 4 / 12, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 7, myHeight * 4 / 12 - 1, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 6, myHeight * 4 / 12 - 2, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 5, myHeight * 4 / 12 - 3, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 4, myHeight * 4 / 12 - 4, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  tft.drawRect(myWidth * 2 / 16 - 3, myHeight * 4 / 12 - 5, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
  // this fills the center box black
  tft.fillRect(myWidth * 2 / 16 - 2, myHeight * 4 / 12 - 0, myWidth * 13 / 16 + 5, myHeight * 4 / 12 - 5 ,BLACK);
  // text segments
  tft.setCursor(myWidth * 2 / 16, myHeight * 5 / 12 - 10);
  tft.setTextColor(GREEN);
  tft.setTextSize(2);
  tft.print("Code Accepted");
  tft.setCursor(myWidth * 2 / 16, myHeight * 7 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("SYSTEM DETECTIONS");
  tft.setCursor(myWidth * 13 / 16, myHeight * 7 / 12 - 10);
  tft.setTextColor(GREEN);
  tft.setTextSize(2);
  tft.print(detect);
  tft.setCursor(myWidth * 13 / 16 + 12, myHeight * 7 / 12 - 10);
  tft.setTextColor(GREEN);
  tft.setTextSize(2);
  tft.print("/3");
 
}
void gamelost1() {}
void gamewon1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  tft.fillScreen(GREENYELLOW);
  // text segments
  tft.setCursor(myWidth * 4 / 16, myHeight * 6 / 12 - 10);
  tft.setTextColor(TEAL);
  tft.setTextSize(2);
  tft.print("Acces Granted");
 
}

if you fixed it please mark the thread as solved

My bad. Fixed. Will post finished code once I get it completely done.

I Have completed the code project:

/*Libraries provided by adafruit written by Lady Ada Fried.
 *Please stick to adafruit products as chinese knock offs are very,
 *very, very, very, very, very problematic.
 * code for bar courtesy of:
 * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189
 * some code pulled from isolation motion tracker pulled from:
 * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M
 * help found on arduino forums at https://arduino.cc
 */
// Include the Bounce2 library found here :
// https://github.com/thomasfredericks/Bounce2
#include <avr/wdt.h>
#include <Bounce2.h>
#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <LcdProgressBar.h>
#include <LiquidCrystal.h>

// For the Adafruit shield, these are the default.
// USE hardware SPI pins.
// For Micro those pins are CIPO/MISO=D14, COPI/MOSI=D16, SCK=D15
#define TFT_DC 9
#define TFT_CS 10
// the colors are in a RGB565 format, so to get it you first need to grab it as a RGB888 and convert
//go here
//https://imagecolorpicker.com/en
//then here
//http://www.barth-dev.de/online/rgb565-color-picker/
// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define DARKGREEN 0x03E0
#define OLIVE 0x7BE0
#define GREENYELLOW 0xAFE5
#define TEAL 0x263F
// button pins
//22 is a4, 23 is a5 on micro.
#define BUTTON_PIN_1 A5
#define BUTTON_PIN_2 A4
// pot pins are pins 14(a0) and 15(a1)
Bounce debouncer1 = Bounce();
Bounce debouncer2 = Bounce();
enum { initial,
       bar1test,
       bar1passed1,
       bar2test,
       bar2passed1,
       bar3test,
       bar3passed1,
       gamewon,
       gamelost };
unsigned char barstate = bar1test;
//global integer declarations
// arguments exist against global variables, however, they are nice if you use integers across functions
int rangelow;
int rangehigh;
int g1low = 80;
int g1high = 80;
int center;
int detect = 0;
int render = 0;
int b1 = 0;
int b2 = 0;
//invokation for the adafruit TFT
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);  //, TFT_MOSI, TFT_CLK, TFT_MISO);

void setup() {
  pinMode(A0, INPUT);
  tft.begin();
  tft.fillScreen(BLACK);
  tft.setRotation(1);  //this sets 0,0 as the top left corner
  boot1();
  boot2();
  tft.fillScreen(BLACK);
  tft.setRotation(1);
  // button initialization
  pinMode(BUTTON_PIN_1, INPUT_PULLUP);
  debouncer1.attach(BUTTON_PIN_1);
  debouncer1.interval(5);
  pinMode(BUTTON_PIN_2, INPUT_PULLUP);
  debouncer2.attach(BUTTON_PIN_2);
  debouncer2.interval(25);
  // sets up random number generator for game1 to game 2 transition
  randomSeed(analogRead(A3));
  center = random(150, 950);
}

void loop() {
  rangelow = center - g1low;
  rangehigh = center + g1high;
  // comment out the bottom two if else statements and replace them with the below line to aid in calibrating your setup
  // calibration();
  if (rangelow < analogRead(A0) && analogRead(A0) < rangehigh) {
    game2();
  } else {  // this is game1 and has to be here for the detection count to register properly.
    debouncer1.update();
    debouncer2.update();
    int value1 = debouncer1.read();
    int value2 = debouncer2.read();
    int myHeight = tft.height();
    int myWidth = tft.width();
    // this is a delayed screen rerender
    int render1;
    render1++;
    delay(10);
    if (render1 == 2) {
      tft.fillScreen(BLACK);
      render1++;
    }
    if (render1 == 40) { render1 = 0; }
    //I ended up having to separate out remaps for each side of the slider bar
    int bordw = map(analogRead(A0), 0, 1023, 0, 1023);
    int bordt = map(analogRead(A0), 0, 256, 0, myWidth);
    int bordrh = map(analogRead(A0), 256, 512, 0, myHeight);
    int bordb = map(analogRead(A0), 512, 768, myWidth, 0);
    int bordlh = map(analogRead(A0), 768, 1023, myHeight, 0);
    tft.fillRect(bordt, 0, 20, 5, WHITE);
    tft.fillRect(myWidth - 5, bordrh, 5, 20, WHITE);
    tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE);
    tft.fillRect(0, bordlh, 5, 20, WHITE);
    delay(10);
    tft.fillRect(0, 0, 5, myHeight, BLACK);
    tft.fillRect(0, 0, myWidth, 5, BLACK);
    tft.fillRect(myWidth - 5, 0, 5, myHeight, BLACK);
    tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK);
    // center box
    // yellow border
    tft.drawRect(myWidth * 2 / 16 - 8, myHeight * 4 / 12, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
    tft.drawRect(myWidth * 2 / 16 - 7, myHeight * 4 / 12 - 1, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
    tft.drawRect(myWidth * 2 / 16 - 6, myHeight * 4 / 12 - 2, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
    tft.drawRect(myWidth * 2 / 16 - 5, myHeight * 4 / 12 - 3, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
    tft.drawRect(myWidth * 2 / 16 - 4, myHeight * 4 / 12 - 4, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
    tft.drawRect(myWidth * 2 / 16 - 3, myHeight * 4 / 12 - 5, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
    // text segments
    tft.setCursor(myWidth * 2 / 16, myHeight * 5 / 12 - 10);
    tft.setTextColor(WHITE);
    tft.setTextSize(2);
    tft.print("INCORRECT CODE");
    tft.setCursor(myWidth * 2 / 16, myHeight * 7 / 12 - 10);
    tft.setTextColor(WHITE);
    tft.setTextSize(2);
    tft.print("SYSTEM DETECTIONS");
    tft.setCursor(myWidth * 13 / 16, myHeight * 7 / 12 - 10);
    tft.setTextColor(WHITE);
    tft.setTextSize(2);
    tft.print(detect);
    tft.setCursor(myWidth * 13 / 16 + 12, myHeight * 7 / 12 - 10);
    tft.setTextColor(WHITE);
    tft.setTextSize(2);
    tft.print("/3");
    // this is a rerender section
    if (value1 == 0) { b1++; }
    if (b1 == 5) {
      tft.fillScreen(BLACK);
      b1++;
    }
    if (b1 == 7) { b1 = 0; }
    // this is for the static effect
    //row1
    tft.fillRect(myWidth * 1 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 1 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16, myHeight * 1 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16 + 10, myHeight * 1 / 12 + 10, 10, 10, WHITE);
    //row2
    tft.fillRect(myWidth * 1 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 1 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16, myHeight * 2 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16 + 10, myHeight * 2 / 12 + 10, 10, 10, WHITE);
    //half row3
    tft.fillRect(myWidth * 1 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16, myHeight * 3 / 12, 10, 10, WHITE);
    //rows
    tft.fillRect(myWidth * 1 / 16, myHeight * 4 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 1 / 16, myHeight * 5 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 1 / 16, myHeight * 6 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 1 / 16, myHeight * 7 / 12, 10, 10, WHITE);

    //row8
    tft.fillRect(myWidth * 1 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 1 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16, myHeight * 8 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16 + 10, myHeight * 8 / 12 + 10, 10, 10, WHITE);


    //row9
    tft.fillRect(myWidth * 1 / 16, myHeight * 9 / 12, 20, 20, WHITE);
    //tft.fillRect(myWidth * 2 / 16,myHeight * 9 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 3 / 16, myHeight * 9 / 12, 20, 20, WHITE);
    //tft.fillRect(myWidth * 4 / 16,myHeight * 9 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 5 / 16, myHeight * 9 / 12, 20, 20, WHITE);
    //tft.fillRect(myWidth * 6 / 16,myHeight * 9 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 7 / 16, myHeight * 9 / 12, 20, 20, WHITE);
    //tft.fillRect(myWidth * 8 / 16,myHeight * 9 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 9 / 16, myHeight * 9 / 12, 20, 20, WHITE);
    //tft.fillRect(myWidth * 10 / 16,myHeight * 9 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 11 / 16, myHeight * 9 / 12, 20, 20, WHITE);
    //tft.fillRect(myWidth * 12 / 16,myHeight * 9 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 13 / 16, myHeight * 9 / 12, 20, 20, WHITE);
    //tft.fillRect(myWidth * 14 / 16,myHeight * 9 / 12,20,20,WHITE);
    //row10
    tft.fillRect(myWidth * 1 / 16, myHeight * 10 / 12, 10, 10, WHITE);
  //  tft.fillRect(myWidth * 1 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 2 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 3 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 4 / 16, myHeight * 10 / 12, 10, 10, WHITE);
  //  tft.fillRect(myWidth * 4 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 5 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 6 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 7 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 8 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 9 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 10 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 11 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 12 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 13 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16, myHeight * 10 / 12, 10, 10, WHITE);
    tft.fillRect(myWidth * 14 / 16 + 10, myHeight * 10 / 12 + 10, 10, 10, WHITE);
    //row11
    //tft.fillRect(myWidth * 1 / 16,myHeight * 11 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 2 / 16, myHeight * 11 / 12, 20, 15, WHITE);
    //tft.fillRect(myWidth * 3 / 16,myHeight * 11 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 4 / 16, myHeight * 11 / 12, 20, 15, WHITE);
    //tft.fillRect(myWidth * 5 / 16,myHeight * 11 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 6 / 16, myHeight * 11 / 12, 20, 15, WHITE);
    //tft.fillRect(myWidth * 7 / 16,myHeight * 11 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 8 / 16, myHeight * 11 / 12, 20, 15, WHITE);
    //tft.fillRect(myWidth * 9 / 16,myHeight * 11 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 10 / 16, myHeight * 11 / 12, 20, 15, WHITE);
    //tft.fillRect(myWidth * 11 / 16,myHeight * 11 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 12 / 16, myHeight * 11 / 12, 20, 15, WHITE);
    //tft.fillRect(myWidth * 13 / 16,myHeight * 11 / 12,20,20,WHITE);
    tft.fillRect(myWidth * 14 / 16, myHeight * 11 / 12, 20, 15, WHITE);
  }
  // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  delay(20);
}

void calibration() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int bar = map(analogRead(A0), 0, 1023, 0, 308);
  tft.fillRect(6, 80, bar, 44, RED);
  tft.fillRect(bar, 80, 308 - bar, 44, BLACK);
  tft.fillRect(0, 20, myWidth, 5, BLACK);
  // draws pot number reading
  tft.setCursor(80, 40);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(analogRead(A0));
  // draws pot 2 number reading
  tft.setCursor(160, 40);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(analogRead(A1));
  // clears button status
  tft.fillRect(80, 140, 100, 30, BLACK);
  tft.fillRect(80, 180, 100, 30, BLACK);
  // add rendering pause
  delay(100);
  // clears drawings
  tft.fillRect(bar, 20, 20, 5, WHITE);
  tft.fillRect(80, 40, 200, 30, BLACK);
  //math for range sweetspot logic
  rangelow = center - g1low;
  rangehigh = center + g1high;
  if (rangelow < analogRead(A0) && analogRead(A0) < rangehigh) {
    tft.fillRect(230, 40, 20, 20, OLIVE);
  } else {
    tft.fillRect(230, 40, 20, 20, BLACK);
  }
  // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  // draws button 2 status
  tft.setCursor(160, 140);
  tft.setTextColor(RED);
  tft.setTextSize(3);
  tft.println(value2);
  // draws button 1 status
  tft.setCursor(80, 140);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(value1);
  // draws pot 2 status
  tft.setCursor(160, 180);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(rangelow);
  // draws pot 1 status
  tft.setCursor(80, 180);
  tft.setTextColor(OLIVE);
  tft.setTextSize(3);
  tft.println(rangehigh);
  // clears text
}

void boot1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  byte progress = myWidth / 8;
  int progress1;
  tft.fillScreen(BLACK);
  tft.setCursor(30, 10);
  tft.setTextColor(GREEN);
  tft.setTextSize(6);
  tft.println("SEEGSON");
  tft.drawRect(myWidth * 2 / 16, myHeight * 3 / 5, myWidth * 12 / 16 - 5, 50, GREEN);
  for (int i = 0; i < 40; i++) {
    tft.fillRect(myWidth * 2 / 16, myHeight * 3 / 5, progress, 50, GREEN);
    tft.setTextSize(2);
    tft.setCursor(myWidth * 4 / 16, myHeight * 5 / 12);
    tft.print("Progress  ");
    tft.setTextSize(2);
    tft.setCursor(myWidth * 5 / 8, myHeight * 5 / 12);
    progress1 = progress * 17 / 40;
    tft.print(progress1);
    delay(5);
    tft.fillRect(myWidth * 9 / 16, myHeight * 5 / 12, myHeight * 5 / 12, 20, BLACK);
    progress += 5;
  }
}

void boot2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  tft.fillScreen(BLACK);
  tft.setCursor(myWidth * 3 / 16, myHeight * 9 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.print("Please wait");
  //draws verticle line
  tft.drawRect(myWidth / 2, 5, 2, 65, WHITE);
  delay(200);
  tft.drawRect(myWidth / 2, 5, 2, 65, BLACK);
  // draws 45 degree line
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 6, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 9, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 5, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 10, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 4, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 11, WHITE);
  delay(200);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 6, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 9, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 5, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 10, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 4, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 11, BLACK);
  // draws horizontal line
  tft.fillRect(myWidth * 6 / 16 + 5, myHeight * 2 / 12 - 5, 70, 2, WHITE);
  delay(200);
  tft.fillRect(myWidth * 6 / 16 + 5, myHeight * 2 / 12 - 5, 70, 2, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 9, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 6, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 10, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 5, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 11, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 4, WHITE);
  delay(200);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 9, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 6, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 10, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 5, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 11, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 4, BLACK);

  tft.drawRect(myWidth / 2, 5, 2, 65, WHITE);
  delay(200);
  tft.drawRect(myWidth / 2, 5, 2, 65, BLACK);
  // draws 45 degree line
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 6, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 9, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 5, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 10, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 4, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 11, WHITE);
  delay(200);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 6, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 9, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 5, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 10, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 3 / 12 + 4, myWidth * 9 / 16 + 10, myHeight * 1 / 12 - 11, BLACK);
  // draws horizontal line
  tft.fillRect(myWidth * 6 / 16 + 5, myHeight * 2 / 12 - 5, 70, 2, WHITE);
  delay(200);
  tft.fillRect(myWidth * 6 / 16 + 5, myHeight * 2 / 12 - 5, 70, 2, BLACK);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 9, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 6, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 10, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 5, WHITE);
  tft.drawLine(myWidth * 7 / 16 - 10, myHeight * 1 / 12 - 11, myWidth * 9 / 16 + 10, myHeight * 3 / 12 + 4, WHITE);
  delay(200);
}
void game2() {
  // declare variables for function
  int myHeight = tft.height();
  int myWidth = tft.width();
  int estcon;
  int senpak;
  int ovrpak;
  // sets base text for game
  tft.setCursor(myWidth * 3 / 16, myHeight * 1 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.print("SYSTEM OVERRIDE");
  tft.setCursor(myWidth * 4 / 16 - 10, myHeight * 11 / 12);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("SECURITY FREQUENCY MATCH");
  tft.setCursor(myWidth * 4 / 16, myHeight * 12 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("V2.34 SYSTEM TEST");
  //calibrate2(); //turn this on ifyou need to verify you have wiring and settings correct.
  // the big minigame border
  tft.drawRect(3, myHeight * 3 / 12, myWidth - 9, myHeight * 6 / 12, WHITE);
  tft.drawRect(6, myHeight * 3 / 12, myWidth - 15, myHeight * 6 / 12, WHITE);
  int pass1;
  // this rerenders based on button presses
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  //  int detect;
  switch (barstate) {
    case bar1test:
      bar1();
      if (value2 == 0 && 220 < analogRead(A1) && analogRead(A1) < 440) {
        barstate = bar1passed1;
        break;
      }
      if (value2 == 0 && analogRead(A1) > 440) {
        barstate = gamelost;
        detect++;
        break;
      }
      if (value2 == 0 && 220 > analogRead(A1)) {
        barstate = gamelost;
        detect++;
        break;
      }
      break;
    case bar1passed1:
      passedbar1();
      bar2();
      barstate = bar2test;
      break;
    case bar2test:
      passedbar1();
      bar2();
      if (value2 == 0 && 140 < analogRead(A1) && analogRead(A1) < 280) {
        barstate = bar2passed1;
        break;
      }
      if (value2 == 0 && analogRead(A1) > 280) {
        detect++;
        barstate = gamelost;
        break;
      }
      if (value2 == 0 && 140 > analogRead(A1)) {
        detect++;
        barstate = gamelost;       
        break;
      }
      if (value2 == 0 && detect == 3) {
        barstate = gamelost;
        break;
      }
      break;
    case bar2passed1:
      passedbar1();
      passedbar2();
      bar3();
      barstate = bar3test;
      break;
    case bar3test:
      passedbar1();
      passedbar2();
      bar3();
      if (value2 == 0 && 720 > analogRead(A1)) {
        detect++;
        barstate = gamelost;       
        break;
      }
      if (value2 == 0 && analogRead(A1) > 870) {
        detect++;
        barstate = gamelost;
        break;
      }
      if (value2 == 0 && 720 < analogRead(A1) && analogRead(A1) < 870) {
        barstate = bar3passed1;
        break;
      }
      break;
    case bar3passed1:
      passedbar1();
      passedbar2();
      passedbar3();
      barstate = gamewon;
      break;
    case gamewon:
      tft.fillScreen(GREEN);
      // center box   yellow border
      tft.drawRect(myWidth * 2 / 16 - 8, myHeight * 4 / 12, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 7, myHeight * 4 / 12 - 1, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 6, myHeight * 4 / 12 - 2, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 5, myHeight * 4 / 12 - 3, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 4, myHeight * 4 / 12 - 4, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 3, myHeight * 4 / 12 - 5, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      // this fills the center box black
      tft.fillRect(myWidth * 2 / 16 - 2, myHeight * 4 / 12 - 0, myWidth * 13 / 16 + 5, myHeight * 4 / 12 - 5, BLACK);
      // text segments
      tft.setCursor(myWidth * 2 / 16, myHeight * 5 / 12 - 10);
      tft.setTextColor(GREEN);
      tft.setTextSize(2);
      tft.print("Code Accepted");
      tft.setCursor(myWidth * 2 / 16, myHeight * 7 / 12 - 10);
      tft.setTextColor(WHITE);
      tft.setTextSize(2);
      tft.print("SYSTEM DETECTIONS");
      tft.setCursor(myWidth * 13 / 16, myHeight * 7 / 12 - 10);
      tft.setTextColor(GREEN);
      tft.setTextSize(2);
      tft.print(detect);
      tft.setCursor(myWidth * 13 / 16 + 12, myHeight * 7 / 12 - 10);
      tft.setTextColor(GREEN);
      tft.setTextSize(2);
      tft.print("/3");     
      delay(2000);
      tft.fillScreen(GREENYELLOW);
      // text segments
      tft.setCursor(myWidth * 4 / 16, myHeight * 6 / 12 - 10);
      tft.setTextColor(TEAL);
      tft.setTextSize(2);
      tft.print("Acces Granted");
      delay(2000);
      //   This is a software reset call via software functions built into the chipset.
      softwareReset(WDTO_60MS);
      break;
    case gamelost:
      tft.fillScreen(BLACK);
      tft.drawRect(myWidth * 2 / 16 - 8, myHeight * 4 / 12, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 7, myHeight * 4 / 12 - 1, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 6, myHeight * 4 / 12 - 2, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 5, myHeight * 4 / 12 - 3, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 4, myHeight * 4 / 12 - 4, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      tft.drawRect(myWidth * 2 / 16 - 3, myHeight * 4 / 12 - 5, myWidth * 13 / 16 + 12, myHeight * 4 / 12, YELLOW);
      // text segments
      tft.setCursor(myWidth * 2 / 16, myHeight * 5 / 12 - 10);
      tft.setTextColor(RED);
      tft.setTextSize(2);
      tft.print("INCORRECT CODE");
      tft.setCursor(myWidth * 2 / 16, myHeight * 7 / 12 - 10);
      tft.setTextColor(WHITE);
      tft.setTextSize(2);
      tft.print("SYSTEM DETECTIONS");
      tft.setCursor(myWidth * 13 / 16, myHeight * 7 / 12 - 10);
      tft.setTextColor(WHITE);
      tft.setTextSize(2);
      tft.print(detect);
      tft.setCursor(myWidth * 13 / 16 + 12, myHeight * 7 / 12 - 10);
      tft.setTextColor(WHITE);
      tft.setTextSize(2);
      tft.print("/3");
      tone(12, 500, 70);
      delay(1500);
      //      This is the logic for the counter on detection attempts/failures.  It resets once it reaches 3.
      tft.fillScreen(TEAL);
      if (detect <= 2) {
        barstate = bar1test;
        break;
      }
      if (detect >= 3) {
        softwareReset(WDTO_60MS);
        break;
      }
      break;
  }
  // this is a rerender section based on pushing a button
  if (value1 == 0) { b1++; }
  if (b1 == 5) {
    tft.fillScreen(TEAL);
    b1++;
  }
  if (b1 == 7) { b1 = 0; }  //
  //  This delays the redrawing of the entire screen
  render++;
  delay(10);
  if (render == 2) {
    tft.fillScreen(TEAL);
    render++;
  }
  if (render == 70) { render = 0; }
}
void bar1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int estcon;
  // bar 1 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 3 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Establishing Connection");
  estcon = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(estcon, myHeight * 4 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 4 / 12, estcon - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(estcon + 12, myHeight * 4 / 12, myWidth - estcon - 30, 15, TEAL);
  // these are the static vertical lines on the bar
  tft.drawRect(9, myHeight * 4 / 12, myWidth - 30, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 4 / 12, 30, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 7 / 16, myHeight * 4 / 12, 4, 15, WHITE);
}
void bar2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int senpak;
  // bar 2 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 5 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Sending Packets");
  senpak = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(senpak, myHeight * 6 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 6 / 12, senpak - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(senpak + 12, myHeight * 6 / 12, myWidth - senpak - 30, 15, TEAL);
  // draws lines
  tft.drawRect(9, myHeight * 6 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
}
void bar3() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int ovrpak;
  //bar 3
  tft.setCursor(20, myHeight * 7 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Overriding Protocol");
  ovrpak = map(analogRead(A1), 0, 1023, 10, 295);
  tft.fillRect(ovrpak, myHeight * 8 / 12, 5, 15, WHITE);
  // redraws left of the slider
  tft.fillRect(9, myHeight * 8 / 12, ovrpak - 1, 15, TEAL);
  // redraws right of the slider
  tft.fillRect(ovrpak + 12, myHeight * 8 / 12, myWidth - ovrpak - 30, 15, TEAL);
  // draws lines
  tft.drawRect(9, myHeight * 8 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
}
void calibrate2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  // calibration testing
  tft.setCursor(myWidth * 4 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.println(analogRead(A1));
  // declarations for buttons
  debouncer1.update();
  debouncer2.update();
  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  // draws button 2 status
  tft.setCursor(myWidth * 6 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(RED);
  tft.setTextSize(1);
  tft.println(value2);
  // draws button 1 status
  tft.setCursor(myWidth * 8 / 16, myHeight * 10 / 12 - 10);
  tft.setTextColor(OLIVE);
  tft.setTextSize(1);
  tft.println(value1);
  delay(10);
  tft.fillRect(myWidth * 4 / 16, myHeight * 10 / 12 - 10, 100, 20, TEAL);
  // end calibration testing section
}

void passedbar1() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  // renders static bar once bar 1 passed checks
  tft.setCursor(20, myHeight * 3 / 12 + 5);
  tft.drawRect(20, myHeight * 3 / 12 + 5, 200, 15, TEAL);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Established Connection");
  tft.drawRect(9, myHeight * 4 / 12, myWidth - 30, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 4 / 12, 30, 15, WHITE);
  tft.drawLine(myWidth - 50, myHeight * 4 / 12, myWidth - 35, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 49, myHeight * 4 / 12, myWidth - 34, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 48, myHeight * 4 / 12, myWidth - 33, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 47, myHeight * 4 / 12, myWidth - 32, myHeight * 5 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 35, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 10, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 34, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 9, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 33, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 8, myHeight * 3 / 12, GREEN);
  tft.drawLine(myWidth - 32, myHeight * 5 / 12 - 10, myWidth * 15 / 16 + 7, myHeight * 3 / 12, GREEN);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 5 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 - 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 6 / 16 + 10, myHeight * 4 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 7 / 16, myHeight * 4 / 12, 4, 15, WHITE);
}
void passedbar2() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int senpak;
  // bar 2 override takes reading from slider pot and draws the bar
  tft.setCursor(20, myHeight * 5 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Packet Sent");
  // draws lines
  tft.drawRect(9, myHeight * 6 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 3 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 - 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16, myHeight * 6 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 4 / 16 + 10, myHeight * 6 / 12, 4, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 6 / 12, 30, 15, WHITE);
  tft.drawLine(myWidth - 50, myHeight * 6 / 12, myWidth - 35, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 49, myHeight * 6 / 12, myWidth - 34, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 48, myHeight * 6 / 12, myWidth - 33, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 47, myHeight * 6 / 12, myWidth - 32, myHeight * 7 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 35, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 10, myHeight * 5 / 12, GREEN);
  tft.drawLine(myWidth - 34, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 9, myHeight * 5 / 12, GREEN);
  tft.drawLine(myWidth - 33, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 8, myHeight * 5 / 12, GREEN);
  tft.drawLine(myWidth - 32, myHeight * 7 / 12 - 10, myWidth * 15 / 16 + 7, myHeight * 5 / 12, GREEN);
}
void passedbar3() {
  int myHeight = tft.height();
  int myWidth = tft.width();
  int ovrpak;
  tft.setCursor(20, myHeight * 7 / 12 + 5);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.print("Protocol Bypassed");
  // draws lines
  tft.drawRect(9, myHeight * 8 / 12, myWidth - 30, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 11 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 - 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16, myHeight * 8 / 12, 4, 15, WHITE);
  tft.drawRect(myWidth * 12 / 16 + 10, myHeight * 8 / 12, 4, 15, WHITE);
  tft.fillRect(myWidth - 50, myHeight * 8 / 12, 30, 15, WHITE);
  tft.drawLine(myWidth - 50, myHeight * 8 / 12, myWidth - 35, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 49, myHeight * 8 / 12, myWidth - 34, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 48, myHeight * 8 / 12, myWidth - 33, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 47, myHeight * 8 / 12, myWidth - 32, myHeight * 9 / 12 - 10, GREEN);
  tft.drawLine(myWidth - 35, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 10, myHeight * 7 / 12, GREEN);
  tft.drawLine(myWidth - 34, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 9, myHeight * 7 / 12, GREEN);
  tft.drawLine(myWidth - 33, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 8, myHeight * 7 / 12, GREEN);
  tft.drawLine(myWidth - 32, myHeight * 9 / 12 - 10, myWidth * 15 / 16 + 7, myHeight * 7 / 12, GREEN);
}
void softwareReset(uint8_t prescaller) {
  wdt_enable(prescaller);
  while (1) {}
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.