Sketch size and memory

Hey, guys!

Recently I've started my first project and it's pretty extensive, but I'm a newbie and didn't have in mind the sketch size limitations I guess. But, recently I've been experiencing somewhat weird behaviour. Everything's working fine, I add a few lines, and boom - the things that were previously working, and are unrelated to the new lines, now aren't working and everything starts acting weird until I go around and try to get rid of any unneeded variables or make them smaller. Here's a ss of the sketch's memory usage - I thought I still had memory left, and didn't think it to be concerning, but now I'm not sure whether it's a problem. I also have a single String in the program (I know - BAD), but it's not being used in the part of the sketch that I am trying to test.

You are not out of memory, and there are easy things to do to use more flash and less ram.
HOWEVER, have a look at How to use the forumj

No problem, I don't help students, in my day they called that cheating.
MUTING

2 Likes

When you post your complete code correctly, a 1/4 page, scrollable, code box lets you post thousands of lines without burdening the reader. Nobody can help if you keep your hardware and software a secret. Besides, everyone else in your group is doing the same thing (divulging the very same information you have). Your choice. Do what you know is right.

Here... have some code. Fun is not a secret.

And my dancing sprinklers...

1 Like

Don't worry about being a student and asking for help. Just put in in your OP that you are a student, or this is for a hobby, or this is for retail. People who want to help will, and people who don't want to help will not chime in then. Basically, give them the option up front.

That said, I don't think it is cheating to ask for help.

Ok, on to your question, you are running out of dynamic memory during your program. To break it down, there is flash memory and dynamic memory, and something to do with the heap and the stack. And I get them confused even though I have sit through a few lessons on the subject. One of the easiest ways to help with too much dynamic memory is to use something called an F macro to store strings into your flash. That way during runtime they get pushed onto the stack and not into the heap. I think the heap is your dynamic memory.

I have a thread on here where I wasn't a very gracious poster, but nonetheless I got a lot of help and in that thread someone quite literally spelled out what I needed to do to use the F macro, but again, the gist is you will store "strings" into flash instead of allocating them on the heap during runtime.

1 Like

Do you have Serial debugging/messages in it?
If you have this:

Serial.println("myMessage");

shift it to flash using the F macro like this:

Serial.println(F("myMessage"));

I see you're already at 62% program storage space but better to come close to the wire there (if I'm not mistaken) than to risk running out of RAM.

Pshaw, take a look at this 3500 liner (you may see some tips in it - it's a sketch to RFID identify almost every GI Joe figure and vehicle ever made - 700 odd pieces)


/*
   FIGURE TAGS

  -------------
     277 figure tags

   VEHICLE TAGS (* two images each)

   -------------
   137 vehicle tags
   GRAND TOTAL
   -------------
   543 cards and images in Processing
*/

#include <SPI.h>
#include <MFRC522.h>
uint8_t successRead;
byte storedCard[4];
byte readCard[4];
byte masterCard[4];
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);
boolean veh;
boolean lastv;
boolean tristate;
boolean locked;
String lastString;

// 1983 figures (14)
const char z0[] PROGMEM = "z0";
const char z1[] PROGMEM = "z1";
const char z2[] PROGMEM = "z2";
const char z3[] PROGMEM = "z3";
const char z4[] PROGMEM = "z4";
const char z5[] PROGMEM = "z5";
const char z6[] PROGMEM = "z6";
const char z7[] PROGMEM = "z7";
const char z8[] PROGMEM = "z8";
const char z9[] PROGMEM = "z9";
const char z10[] PROGMEM = "z10";
const char z11[] PROGMEM = "z11";
const char z12[] PROGMEM = "z12";
const char z13[] PROGMEM = "z13";
const char *const threezies[] PROGMEM = {z0,
                                         z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13
                                        };

// 1984 figures (18)
const char y0[] PROGMEM = "y0";
const char y1[] PROGMEM = "y1";
const char y2[] PROGMEM = "y2";
const char y3[] PROGMEM = "y3";
const char y4[] PROGMEM = "y4";
const char y5[] PROGMEM = "y5";
const char y6[] PROGMEM = "y6";
const char y7[] PROGMEM = "y7";
const char y8[] PROGMEM = "y8";
const char y9[] PROGMEM = "y9";
const char y10[] PROGMEM = "y10";
const char y11[] PROGMEM = "y11";
const char y12[] PROGMEM = "y12";
const char y13[] PROGMEM = "y13";
const char y14[] PROGMEM = "y14";
const char y15[] PROGMEM = "y15";
const char y16[] PROGMEM = "y16";
const char y17[] PROGMEM = "y17";
const char *const fourzies[] PROGMEM = {y0,
                                        y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13,
                                        y14, y15, y16, y17
                                       };

// 1986 vehicles (18)
const char acb[] PROGMEM = "acb";
const char acf[] PROGMEM = "acf";
const char ctdb[] PROGMEM = "ctdb";
const char ctdf[] PROGMEM = "ctdf";
const char daab[] PROGMEM = "daab";
const char daaf[] PROGMEM = "daaf";
const char dfb[] PROGMEM = "dfb";
const char dff[] PROGMEM = "dff";
const char dgab[] PROGMEM = "dgab";
const char dgaf[] PROGMEM = "dgaf";
const char dsfb[] PROGMEM = "dsfb";
const char dsff[] PROGMEM = "dsff";
const char dtmb[] PROGMEM = "dtmb";
const char dtmf[] PROGMEM = "dtmf";
const char havb[] PROGMEM = "havb";
const char havf[] PROGMEM = "havf";
const char hyb[] PROGMEM = "hyb";
const char hyf[] PROGMEM = "hyf";
const char lab[] PROGMEM = "lab";
const char laf[] PROGMEM = "laf";
const char lcvb[] PROGMEM = "lcvb";
const char lcvf[] PROGMEM = "lcvf";
const char otdb[] PROGMEM = "otdb";
const char otdf[] PROGMEM = "otdf";
const char prb[] PROGMEM = "prb";
const char prf[] PROGMEM = "prf";
const char rvb[] PROGMEM = "rvb";
const char rvf[] PROGMEM = "rvf";
const char stunb[] PROGMEM = "stunb";
const char stunf[] PROGMEM = "stunf";
const char tomb[] PROGMEM = "tomb";
const char tomf[] PROGMEM = "tomf";
const char tttb[] PROGMEM = "tttb";
const char tttf[] PROGMEM = "tttf";
const char x30b[] PROGMEM = "x30b";
const char x30f[] PROGMEM = "x30f";
const char *const eightsix[] PROGMEM = {acf, acb, ctdf, ctdb, daaf, daab, dff, dfb, dgaf, dgab,
                                        dsff, dsfb, dtmf, dtmb, havf, havb, hyf, hyb, laf, lab, lcvf, lcvb, otdf, otdb, prf, prb, rvf, rvb, stunf, stunb,
                                        tomf, tomb, tttf, tttb, x30f, x30b
                                       };


// 1987 vehicles
const char brbb[] PROGMEM = "brbb";
const char brbf[] PROGMEM = "brbf";
const char buzb[] PROGMEM = "buzb";
const char buzf[] PROGMEM = "buzf";
const char cjb[] PROGMEM = "cjb";
const char cjf[] PROGMEM = "cjf";
const char coab[] PROGMEM = "coab";
const char coaf[] PROGMEM = "coaf";
const char cwob[] PROGMEM = "cwob";
const char cwof[] PROGMEM = "cwof";
const char dasb[] PROGMEM = "dasb";
const char dasf[] PROGMEM = "dasf";
const char dcyb[] PROGMEM = "dcyb";
const char dcyf[] PROGMEM = "dcyf";
const char defb[] PROGMEM = "defb";
const char deff[] PROGMEM = "deff";
const char magb[] PROGMEM = "magb";
const char magf[] PROGMEM = "magf";
const char mamb[] PROGMEM = "mamb";
const char mamf[] PROGMEM = "mamf";
const char mccb[] PROGMEM = "mccb";
const char mccf[] PROGMEM = "mccf";
const char pgb[] PROGMEM = "pgb";
const char pgf[] PROGMEM = "pgf";
const char psb[] PROGMEM = "psb";
const char psf[] PROGMEM = "psf";
const char rcb[] PROGMEM = "rcb";
const char rcf[] PROGMEM = "rcf";
const char serb[] PROGMEM = "serb";
const char serf[] PROGMEM = "serf";
const char slmb[] PROGMEM = "slmb";
const char slmf[] PROGMEM = "slmf";
const char *const eightseven[] PROGMEM = {brbf, brbb, buzf, buzb, cjf, cjb, coaf, coab, cwof, cwob,
                                          dasf, dasb, dcyf, dcyb, deff, defb, magf, magb, mamf, mamb, mccf, mccb, pgf, pgb, psf, psb, rcf, rcb,
                                          serf, serb, slmf, slmb
                                         };
const char swb[] PROGMEM = "swb";
const char swf[] PROGMEM = "swf";
const char adb[] PROGMEM = "adb";
const char adf[] PROGMEM = "adf";
const char agb[] PROGMEM = "agb";
const char agf[] PROGMEM = "agf";
const char ddb[] PROGMEM = "ddb";
const char ddf[] PROGMEM = "ddf";
const char dmb[] PROGMEM = "dmb";
const char dmf[] PROGMEM = "dmf";
const char meb[] PROGMEM = "meb";
const char mef[] PROGMEM = "mef";
const char nsb[] PROGMEM = "nsb";
const char nsf[] PROGMEM = "nsf";
const char rob[] PROGMEM = "rob";
const char rof[] PROGMEM = "rof";
const char ssb[] PROGMEM = "ssb";
const char ssf[] PROGMEM = "ssf";
const char wab[] PROGMEM = "wab";
const char waf[] PROGMEM = "waf";
const char x1b[] PROGMEM = "x1b";
const char x1f[] PROGMEM = "x1f";
const char xwb[] PROGMEM = "xwb";
const char xwf[] PROGMEM = "xwf";
const char *const eighteight[] PROGMEM = { swf, swb, adf, adb, agf, agb,
                                           ddf, ddb, dmf, dmb, mef, meb, nsf, nsb, rof, rob, ssf, ssb, waf, wab,
                                           x1f, x1b, xwf, xwb
                                         };

const char a89b[] PROGMEM = "a89b";
const char a89f[] PROGMEM = "a89f";
const char cob[] PROGMEM = "cob";
const char cof[] PROGMEM = "cof";
const char eqb[] PROGMEM = "eqb";
const char eqf[] PROGMEM = "eqf";
const char evb[] PROGMEM = "evb";
const char evf[] PROGMEM = "evf";
const char hib[] PROGMEM = "hib";
const char hif[] PROGMEM = "hif";
const char lyb[] PROGMEM = "lyb";
const char lyf[] PROGMEM = "lyf";
const char mub[] PROGMEM = "mub";
const char muf[] PROGMEM = "muf";
const char *const eightnine[] PROGMEM = {a89f, a89b, cof, cob,
                                         eqf, eqb, evf, evb, hif, hib, lyf, lyb, muf, mub
                                        };

const char alb[] PROGMEM = "alb";
const char alf[] PROGMEM = "alf";
const char dsdb[] PROGMEM = "dsdb";
const char dsdf[] PROGMEM = "dsdf";
const char gelb[] PROGMEM = "gelb";
const char gelf[] PROGMEM = "gelf";
const char hamb[] PROGMEM = "hamb";
const char hamf[] PROGMEM = "hamf";
const char hhb[] PROGMEM = "hhb";
const char hhf[] PROGMEM = "hhf";
const char mbbb[] PROGMEM = "mbbb";
const char mbbf[] PROGMEM = "mbbf";
const char ovb[] PROGMEM = "ovb";
const char ovf[] PROGMEM = "ovf";
const char pirb[] PROGMEM = "pirb";
const char pirf[] PROGMEM = "pirf";
const char ravb[] PROGMEM = "ravb";
const char ravf[] PROGMEM = "ravf";
const char sh90b[] PROGMEM = "sh90b";
const char sh90f[] PROGMEM = "sh90f";
const char *const ninety[] PROGMEM = {alf, alb,
                                      dsdf, dsdb, gelf, gelb, hamf, hamb, hhf, hhb, mbbf, mbbb, ovf, ovb, pirf, pirb,
                                      ravf, ravb, sh90f, sh90b
                                     };

// 1990 vehicles part 2
const char f6[] PROGMEM = "f6";
const char f7[] PROGMEM = "f7";
const char f8[] PROGMEM = "f8";
const char f9[] PROGMEM = "f9";
const char g1[] PROGMEM = "g1";
const char g2[] PROGMEM = "g2";
const char g3[] PROGMEM = "g3";
const char g4[] PROGMEM = "g4";
const char g5[] PROGMEM = "g5";
const char g6[] PROGMEM = "g6";
const char g7[] PROGMEM = "g7";
const char g8[] PROGMEM = "g8";
const char g9[] PROGMEM = "g9";
const char h1[] PROGMEM = "h1";
const char h2[] PROGMEM = "h2";
const char h3[] PROGMEM = "h3";
const char h4[] PROGMEM = "h4";
const char h5[] PROGMEM = "h5";
const char h6[] PROGMEM = "h6";
const char h7[] PROGMEM = "h7";
const char h8[] PROGMEM = "h8";
const char h9[] PROGMEM = "h9";
const char i1[] PROGMEM = "i1";
const char i2[] PROGMEM = "i2";
const char i3[] PROGMEM = "i3";
const char i4[] PROGMEM = "i4";
const char i5[] PROGMEM = "i5";
const char i6[] PROGMEM = "i6";
const char i7[] PROGMEM = "i7";
const char i8[] PROGMEM = "i8";
const char i9[] PROGMEM = "i9";
const char j1[] PROGMEM = "j1";
const char j2[] PROGMEM = "j2";
const char j3[] PROGMEM = "j3";
const char j4[] PROGMEM = "j4";
const char j5[] PROGMEM = "j5";
const char *const ninetyPtTwo[] PROGMEM = {f6, f7, f8, f9,
                                           g1, g2, g3, g4, g5, g6, g7, g8, g9, h1, h2, h3, h4, h5, h6, h7, h8, h9,
                                           i1, i2, i3, i4, i5, i6, i7, i8, i9, j1, j2,
                                           j3, j4, j5
                                          };

// 91
const char attb[] PROGMEM = "attb";
const char attf[] PROGMEM = "attf";
const char badb[] PROGMEM = "badb";
const char badf[] PROGMEM = "badf";
const char bawb[] PROGMEM = "bawb";
const char bawf[] PROGMEM = "bawf";
const char *const nineone[] PROGMEM = {attf, attb, badf, badb,
                                       bawf, bawb
                                      };

// 92
const char hq92f[] PROGMEM = "hq92f";
const char hq92b[] PROGMEM = "hq92b";
const char liqf[] PROGMEM = "liqf";
const char liqb[] PROGMEM = "liqb";
const char steaf[] PROGMEM = "steaf";
const char steab[] PROGMEM = "steab";
const char *const ninetwo[] PROGMEM = {hq92f,
                                       hq92b, liqf, liqb, steaf, steab
                                      };

// 93
const char abf[] PROGMEM = "abf";
const char abb[] PROGMEM = "abb";
const char gtf[] PROGMEM = "gtf";
const char gtb[] PROGMEM = "gtb";
const char s9f[] PROGMEM = "s9f";
const char s9b[] PROGMEM = "s9b";
const char sbf[] PROGMEM = "sbf";
const char sbb[] PROGMEM = "sbb";
const char *const ninethree[] PROGMEM = {abf,
                                         abb, gtf, gtb, s9f, s9b, sbf, sbb
                                        };

// 94
const char bbf[] PROGMEM = "bbf";
const char bbb[] PROGMEM = "bbb";
const char cff[] PROGMEM = "cff";
const char cfb[] PROGMEM = "cfb";
const char pff[] PROGMEM = "pff";
const char pfb[] PROGMEM = "pfb";
const char rbf[] PROGMEM = "rbf";
const char rbb[] PROGMEM = "rbb";
const char *const ninefour[] PROGMEM = {bbf,
                                        bbb, cff, cfb, pff, pfb, rbf, rbb
                                       };
// 1990-1994 figures
const char a1[] PROGMEM = "a1";
const char a2[] PROGMEM = "a2";
const char a3[] PROGMEM = "a3";
const char a4[] PROGMEM = "a4";
const char a5[] PROGMEM = "a5";
const char a6[] PROGMEM = "a6";
const char a7[] PROGMEM = "a7";
const char a8[] PROGMEM = "a8";
const char a9[] PROGMEM = "a9";
const char b1[] PROGMEM = "b1";
const char b2[] PROGMEM = "b2";
const char b3[] PROGMEM = "b3";
const char b4[] PROGMEM = "b4";
const char b5[] PROGMEM = "b5";
const char b6[] PROGMEM = "b6";
const char b7[] PROGMEM = "b7";
const char b8[] PROGMEM = "b8";
const char b9[] PROGMEM = "b9";
const char c1[] PROGMEM = "c1";
const char c2[] PROGMEM = "c2";
const char c3[] PROGMEM = "c3";
const char c4[] PROGMEM = "c4";
const char c5[] PROGMEM = "c5";
const char c6[] PROGMEM = "c6";
const char c7[] PROGMEM = "c7";
const char c8[] PROGMEM = "c8";
const char c9[] PROGMEM = "c9";
const char d1[] PROGMEM = "d1";
const char d2[] PROGMEM = "d2";
const char d3[] PROGMEM = "d3";
const char d4[] PROGMEM = "d4";
const char d5[] PROGMEM = "d5";
const char *const nineties[] PROGMEM = {a1,
                                        a2, a3, a4, a5, a6, a7, a8, a9, b1, b2, b3, b4, b5, b6, b7, b8,
                                        b9, c1, c2, c3, c4, c5, c6, c7, c8, c9, d1, d2, d3, d4, d5
                                       };

const char d6[] PROGMEM = "d6";
const char d7[] PROGMEM = "d7";
const char d8[] PROGMEM = "d8";
const char d9[] PROGMEM = "d9";
const char e1[] PROGMEM = "e1";
const char e2[] PROGMEM = "e2";
const char e3[] PROGMEM = "e3";
const char e4[] PROGMEM = "e4";

const char *const lastones[] PROGMEM = {d6, d7, d8, d9, e1, e2, e3, e4,};

const char e5[] PROGMEM = "e5";
const char e6[] PROGMEM = "e6";
const char e7[] PROGMEM = "e7";
const char e8[] PROGMEM = "e8";
const char e9[] PROGMEM = "e9";
const char f1[] PROGMEM = "f1";
const char f2[] PROGMEM = "f2";
const char f3[] PROGMEM = "f3";
const char f4[] PROGMEM = "f4";
const char f5[] PROGMEM = "f5";
const  char *const uzis[] PROGMEM = {e5, e6, e7, e8, e9, f1, f2, f3, f4, f5};

char buffer[1];


void setup() {
  Serial.begin(115200);
  SPI.begin();
  mfrc522.PCD_Init();
  mfrc522.PCD_SetAntennaGain(mfrc522.RxGain_max);
  veh = true;
  lastv = true;
  locked = false;
  tristate = false;
}

void loop() {
  // vehicles
  byte i; // 86
  byte j; // 87
  byte k; // 88
  byte l; // 89
  byte m; // 90
  byte n; // 91
  byte o; // 92
  byte p; // 93
  byte q; // 94
  byte r; // figures 1990-1994
  byte s; // more 90s figs
  byte t; // forgotten 84 playsets
  byte u; // 1990 vehicles, part 2
  byte z; // 1983 figures redux
  byte y; // 1984 figures redux

  if (Serial.available() > 0) {

    char in = Serial.read();
    if ((in == 'e') || (in == 'E')) {
      locked = true;
    }
    else if ((in == 'a') || (in == 'A')) {
      locked = false;
    }
  }
  switch (locked) {
    case false:
      if ( ! mfrc522.PICC_IsNewCardPresent())
      {
        return;
      }
      // Select one of the cards
      if ( ! mfrc522.PICC_ReadCardSerial())
      {
        return;
      }
      String content = "";
      // byte letter;
      // original version
      // for (byte i = 0; i < mfrc522.uid.size; i++)
      // new version for sticker tags, trim off identical first couple of digits
      for (byte i = 0; i < mfrc522.uid.size - 2; i++)
      {
        Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
        Serial.print(mfrc522.uid.uidByte[i], HEX);
        content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : ""));
        content.concat(String(mfrc522.uid.uidByte[i], HEX));
      }
      Serial.println();
      content.toUpperCase();
      if ((lastv == true) && (content.substring(1) != lastString)) {
        veh = true;
      }
      // 1982 (16)
      if (content.substring(7, 2) == "91635") // 04916353B7
      {
        Serial.println(F("bre")); // breaker
      }
      else if (content.substring(7, 2) == "7C635") // 047C6353B7
      {
        Serial.println(F("clut")); // clutch
      }
      else if (content.substring(7, 2) == "31285") // 04 31285 2B72A81
      {
        Serial.println(F("ccv1")); // cobra commander v1 (shiny helmet)
      }
      else if (content.substring(7, 2) == "2F285") // 042F2852B72A
      {
        Serial.println(F("cobrai")); // cobra infantry
      }
      else if (content.substring(7, 2) == "EE572") //04EE5721B62A
      {
        Serial.println(F("cobrao")); // cobra officer
      }
      else if (content.substring(1) == "")
      {
        Serial.println(F("fla")); // flash
      }
      else if (content.substring(1) == "")
      {
        Serial.println(F("gran")); // grand slam
      }
      else if (content.substring(7, 2) == "32285") // 04322852B72A
      {
        Serial.println(F("grunt")); // grunt
      }
      else if (content.substring(7, 2) == "88635") // 04886353B7
      {
        Serial.println(F("hawkv1")); // hawk v1
      }
      else if (content.substring(7, 2) == "EE572") // 04EE5721B62A
      {
        Serial.println(F("rock")); // rock n roll
      }
      else if (content.substring(7, 2) == "87635") // 04876353B7
      {
        Serial.println(F("scar")); // scarlett
      }
      else if (content.substring(1) == "")
      {
        Serial.println(F("short")); // short fuze
      }
      else if (content.substring(7, 2) == "86635") //04866353B7

      {
        Serial.println(F("snakev1")); // snake eyes v1
      }
      else if (content.substring(7, 2) == "F2572") // 04F25721B6
      {
        Serial.println(F("stal")); // stalker
      }
      else if (content.substring(1) == "")
      {
        Serial.println(F("stel")); // steeler
      }
      else if (content.substring(1) == "")
      {
        Serial.println(F("zap")); // zap
      }


      // 1983 figures
      else if (content.substring(1) == "50D1004")
      {
        z = 0;
        threefigs(z); // ace
      }
      else if (content.substring(7, 2) == "8091104")
      {
        z = 1;
        threefigs(z); //airborne
      }
      else if (content.substring(7, 2) == "76635") // 04766353B7
      {
        z = 2;
        threefigs(z); // cover girl
      }
      else if (content.substring(7, 2) == "75635") // 04756353B7
      {
        z = 3;
        threefigs(z); // destro
      }
      else if (content.substring(7, 2) == "8F01004")
      {
        z = 4;
        threefigs(z); // doc
      }
      else if (content.substring(7, 2) == "74635") // 04746353B7
      {
        z = 5;
        threefigs(z); // duke
      }
      else if (content.substring(7, 2) == "7F635") // 047F6353B7
      {
        z = 6;
        threefigs(z); // gung ho
      }
      else if (content.substring(7, 2) == "3C11004")
      {
        z = 7;
        threefigs(z); // hiss driver
      }
      else if (content.substring(7, 2) == "DF21004")
      {
        z = 8;
        threefigs(z); // major bludd
      }
      else if (content.substring(7, 2) == "7D635") // 047D6353B7
      {
        z = 9;
        threefigs(z); // snowjob
      }
      else if (content.substring(7, 2) == "7E635") // 047E6353B7
      {
        z = 10;
        threefigs(z); // torpedo
      }
      else if (content.substring(7, 2) == "5A5E5") // 045A5E53B7
      {
        z = 11;
        threefigs(z); // tripwire
      }
      else if (content.substring(7, 2) == "E5D1104")
      {
        z = 12;
        threefigs(z); // viper pilot
      }
      else if (content.substring(7, 2) == "5C635") //045C6353B7
      {
        z = 13;
        threefigs(z); // wild bill
      }


      // 1984 figures (20)
      else if (content.substring(7, 2) == "595E5") // 04595E53B7
      {
        y = 0;
        fourfigs(y); //baroness
      }
      else if (content.substring(1) == "3BA1004")
      {
        y = 1;
        fourfigs(y); // blowtorch
      }
      else if (content.substring(7, 2) == "585E5") // 04585E53B7
      {
        y = 2;
        fourfigs(y); // copperhead
      }
      else if (content.substring(1) == "C661004")
      {
        y = 3;
        fourfigs(y); // cutter
      }
      else if (content.substring(1) == "C731004")
      {
        y = 4;
        fourfigs(y); // deep six
      }
      else if (content.substring(7, 2) == "575E5") // 04575E53B7
      {
        y = 5;
        fourfigs(y); //firefly
      }
      else if (content.substring(7, 2) == "A6B1004")
      {
        y = 6;
        fourfigs(y); // hooded cobra com
      }
      else if (content.substring(7, 2) == "635E5") // 04635E53B7
      {
        y = 7;
        fourfigs(y); // mutt
      }
      else if (content.substring(7, 2) == "3A635") // 043A6353B7
      {
        y = 8;
        fourfigs(y); //recondo
      }
      else if (content.substring(7, 2) == "4A635") // 044A6353B7
      {
        y = 9;
        fourfigs(y); // ripper
      }
      else if (content.substring(7, 2) == "515E5") // 04515E53B7
      {
        y = 10;
        fourfigs(y); // roadblock
      }
      else if (content.substring(7, 2) == "4F5E5") // 044F5E53B7
      {
        y = 11;
        fourfigs(y); // scrap iron
      }
      else if (content.substring(7, 2) == "53635") // 04536353B7
      {
        y = 12;
        fourfigs(y); //spirit
      }
      else if (content.substring(1) == "80F1104")
      {
        y = 13;
        fourfigs(y); // stun driver
      }
      else if (content.substring(7, 2) == "4E5E5") // 044E5E53B7
      {
        y = 14;
        fourfigs(y); //storm shadow v1
      }
      else if (content.substring(1) == "7A71004")
      {
        y = 15;
        fourfigs(y); // thunder
      }
      else if (content.substring(1) == "F021104")
      {
        y = 16;
        fourfigs(y); // wild weasel
      }
      else if (content.substring(7, 2) == "77635") // 04776353B7
      {
        y = 17;
        fourfigs(y); // zartan
      }

      // 1985 figures (27)
      else if (content.substring(1) == "8FD1004")
      {
        Serial.println(F("art")); // airtight

      }
      else if (content.substring(1) == "31E1104")
      {
        Serial.println(F("alp")); // alpine
      }
      else if (content.substring(7, 2) == "6B635") // 046B6353B7
      {
        Serial.println(F("bbq")); // barbecue
      }
      else if (content.substring(7, 2) == "5F5E5") // 045F5E53B7
      {
        Serial.println(F("baz")); // bazooka

      }
      else if (content.substring(7, 2) == "6E635") // 046E6353B7
      {
        Serial.println(F("buz")); // buzzer
      }
      else if (content.substring(1) == "9021104")
      {
        Serial.println(F("cas")); // crankcase
      }
      else if ((content.substring(7, 2) == "615E5") || (content.substring(7, 2) == "625E5"))
      { // 04615E53B7 , 04625E53B7
        Serial.println(F("crg")); // crimson guard
      }
      else if (content.substring(7, 2) == "34635") // 04346353B7
      {
        Serial.println(F("dus")); // dusty
      }
      else if (content.substring(7, 2) == "33635") // 04336353B7
      {
        Serial.println(F("eel")); // eels
      }
      else if (content.substring(7, 2) == "32635") // 04326353B7
      {
        Serial.println(F("fli")); // flint
      }
      else if (content.substring(1) == "58D0F04")
      {
        Serial.println(F("foo")); // footloose
      }
      else if (content.substring(1) == "C4D1004")
      {
        Serial.println(F("fro")); // frostbite

      }
      else if (content.substring(1) == "85A1004")
      {
        Serial.println(F("hmt")); // heavy metal
      }
      else if (content.substring(1) == "8151204")
      {
        Serial.println(F("keh")); // keel haul
      }
      else if (content.substring(7, 2) == "3D635") // 043D6353B7
      {
        Serial.println(F("laj")); // lady jaye
      }
      else if (content.substring(1) == "4831004")
      {
        Serial.println(F("lam")); // lampreys

      }
      else if (content.substring(1) == "97A1004")
      {
        Serial.println(F("qui")); // quick kick
      }
      else if (content.substring(7, 2) == "3C635") // 043C6353B7
      {
        Serial.println(F("rip")); // ripcord
      }
      else if (content.substring(7, 2) == "3B635") // 043B6353B7
      {
        Serial.println(F("shi")); // shipwreck
      }
      else if (content.substring(7, 2) == "21635") // 04216353B7
      {
        Serial.println(F("se2")); // snake eyes v2
      }
      else if (content.substring(7, 2) == "2C635") // 042C6353B7
      {
        Serial.println(F("sns")); // snow serpents
      }
      else if (content.substring(7, 2) == "2B635") // 042B6353B7
      {
        Serial.println(F("tel")); // tele vipers
      }
      else if (content.substring(1) == "37B0F04")
      {
        Serial.println(F("tol")); // tollbooth
      }
      else if (content.substring(7, 2) == "2A635") // 042A6353B7
      {
        Serial.println(F("txx")); // tomax/xamot
      }
      else if (content.substring(7, 2) == "29635") // 04296353B7
      {
        Serial.println(F("txx")); // tomax/xamot
      }
      else if (content.substring(7, 2) == "35635") // 04356353B7
      {
        Serial.println(F("tch")); // torch
      }

      // 1986 figures
      else if (content.substring(1) == "F420F04")
      { Serial.println(F("avac")); // avac pilots

      }
      else if (content.substring(7, 2) == "22635") // 04226353B7
      {
        Serial.println(F("bats")); // bats
      }
      else if ((content.substring(7, 2) == "6B235") || (content.substring(7, 2) == "23635")) // 046B2352B7, 04236353B7
      {
        Serial.println(F("bea")); // beachhead
      }
      else if (content.substring(1) == "A9B1104")
      {
        Serial.println(F("clay")); // claymore
      }
      else if (content.substring(1) == "B951004")
      {
        Serial.println(F("cros")); // cross country
      }
      else if (content.substring(1) == "A8A1104")
      {
        Serial.println(F("dial1")); // dialtone
      }
      else if (content.substring(7, 2) == "24635") // 04246353B7
      {
        Serial.println(F("drmind")); // dr mindbender
      }
      else if (content.substring(7, 2) == "18635") // 04186353B7
      {
        Serial.println(F("genhawk")); // general hawk
      }
      else if (content.substring(1) == "C241004")
      {
        Serial.println(F("ice")); // iceberg
      }

      else if (content.substring(1) == "1A31004")
      {
        Serial.println(F("lea1")); // leatherneck
      }
      else if (content.substring(1) == "3EF1104")
      {
        Serial.println(F("life")); // lifeline
      }
      else if (content.substring(1) == "C010F04")
      {
        Serial.println(F("liti")); // lift ticket
      }
      else if ((content.substring(7, 2) == "BBB55") || (content.substring(7, 2) == "19635")) // 04BBB554B7, 04196353B7
      {
        Serial.println(F("lowl")); // lowlight
      }
      else if (content.substring(1) == "41E1104")
      {
        Serial.println(F("mai1")); // mainframe
      }
      else if (content.substring(1) == "D7D0E04")
      {
        Serial.println(F("monk")); // monkeywrench
      }
      else if (content.substring(1) == "8051104")
      {
        Serial.println(F("mv")); // motor vipers
      }
      else if (content.substring(1) == "A6F1004")
      {
        Serial.println(F("scifi")); // sci fi
      }
      else if (content.substring(7, 2) == "1A635") // 041A6353B7
      {
        Serial.println(F("serp")); // serpentor
      }
      else if ((content.substring(7, 2) == "17582") || (content.substring(7, 2) == "83235")) // 04175821B6,04832352B7
      {
        Serial.println(F("sgt1")); // sgt slaughter
      }
      else if (content.substring(1) == "F960E04")
      {
        Serial.println(F("slip")); // slipstream
      }
      else if (content.substring(1) == "DBC1004")
      {
        Serial.println(F("strv")); // strato viper
      }
      else if (content.substring(1) == "CBF21004")
      {
        Serial.println(F("thr")); // thrasher
      }
      else if (content.substring(1) == "E061104")
      {
        Serial.println(F("vipi")); // viper pilot
      }
      else if (content.substring(1) == "9561004")
      {
        Serial.println(F("wet1")); // wet suit
      }
      else if (content.substring(1) == "8041204")
      {
        Serial.println(F("zan")); // zandar
      }
      else if (content.substring(7, 2) == "84235") // 04842352B7
      {
        Serial.println(F("zara")); // zarana
      }


      //1987 figures (41 cards)
      else if (content.substring(1) == "17B1104")
      {
        Serial.println(F("ava")); // avalanche
      }
      else if (content.substring(1) == "E311104")
      {
        Serial.println(F("back")); // backstop
      }
      else if (content.substring(1) == "D261104")
      {
        Serial.println(F("bigb")); // big boa
      }
      else if (content.substring(1) == "7051204")
      {
        Serial.println(F("blas")); // blaster
      }
      else if (content.substring(1) == "D000F04")
      {
        Serial.println(F("bloc")); // blocker
      }
      else if (content.substring(1) == "AF51004")
      {
        Serial.println(F("ccv3")); // cobra commander v3 (battle armor)
      }
      else if (content.substring(7,2) == "8C235") // 048C2352B7
      {
        Serial.println(F("chuc")); // chuckles
      }
      else if (content.substring(7,2) == "6C235") // 046C2352B7
      {
        Serial.println(F("craz")); // crazylegs
      }
      else if (content.substring(7,2) == "8B235") // 048B2352B7
      {
        Serial.println(F("croc")); // croc master
      }
      else if (content.substring(1) == "FE31004")
      {
        Serial.println(F("crys")); // crystal ball 
      }
      else if (content.substring(1) == "B441104")
      {
        Serial.println(F("dodg")); // dodger
      }
      else if (content.substring(7,2) == "61235") // 04612352B7
      {
        Serial.println(F("fal")); // lt falcon
      }
      else if (content.substring(1) == "06B1004")
      {
        Serial.println(F("fasd")); // fast draw
      }
      else if (content.substring(1) == "E1E1104")
      {
        Serial.println(F("frig")); // william "refrigerator" perry
      }
      else if (content.substring(1) == "EEA0D04")
      {
        Serial.println(F("golo")); // golobulus
      }
      else if (content.substring(1) == "EBE0E04")
      {
        Serial.println(F("gun2")); // gung ho v2 (marine dress)
      }
      else if (content.substring(1) == "57A1104")
      {
        Serial.println(F("gyv")); // gyro vipers
      }
      else if (content.substring(1) == "54C0F04")
      {
        Serial.println(F("htop")); // hardtop
      }
      else if (content.substring(1) == "DB91104")
      {
        Serial.println(F("icev")); // ice vipers
      }
      else if (content.substring(7,2) == "42235") // 04422352B7
      {
        Serial.println(F("jinx")); // jinx
      }
      else if (content.substring(1) == "C7C0F04")
      {
        Serial.println(F("kod")); // knockdown
      }
      else if (content.substring(1) == "A761004")
      {
        Serial.println(F("law")); // law and order
      }
      else if (content.substring(1) == "A501004")
      {
        Serial.println(F("mave")); // maverick
      }
      else if (content.substring(1) == "4221004")
      {
        Serial.println(F("merc")); // mercer
      }
      else if (content.substring(1) == "8041004")
      {
        Serial.println(F("neme")); // nemesis enforcer
      }
      else if (content.substring(7,2) == "F3572") // 04F35721B6
      {
        Serial.println(F("outba")); // outback
      }
      else if (content.substring(1) == "AB21004")
      {
        Serial.println(F("payl")); // pantload
      }
      else if (content.substring(1) == "BF71104")
      {
        Serial.println(F("sike")); // psyche out
      }
      else if (content.substring(1) == "E471104")
      {
        Serial.println(F("rapt")); // raptor
      }
      else if (content.substring(1) == "1DF1104")
      {
        Serial.println(F("redd")); // red dog
      }
      else if (content.substring(1) == "5010F04")
      {
        Serial.println(F("royg")); // cobra la royal guard
      }
      else if (content.substring(1) == "90F0F04")
      {
        Serial.println(F("rumb")); // rumbler
      }
      else if (content.substring(1) == "9261104")
      {
        Serial.println(F("sesl")); // sea slug
      }
      else if (content.substring(1) == "1181004")
      {
        Serial.println(F("snek")); // sneak peek
      }
      else if (content.substring(1) == "9B80E04")
      {
        Serial.println(F("stad"));
      }
      else if (content.substring(1) == "A791004")
      {
        Serial.println(F("stam")); // steam roller
      }
      else if (content.substring(1) == "BCD1004")
      {
        Serial.println(F("tau")); // taurus
      }
      else if (content.substring(1) == "7AB0E04")
      {
        Serial.println(F("tecv")); // techno viper
      }
      else if (content.substring(7,2) == "37235") // 04372352B7
      {
        Serial.println(F("trat")); // tunnel rat
      }
      else if (content.substring(1) == "1FF0E04")
      {
        Serial.println(F("wrms")); // worms
      }
      else if (content.substring(1) == "F051104")
      {
        Serial.println(F("zanz")); // zanzibar
      }
      
      // 1988 figures (49 cards)
      else if (content.substring(1) == "5021004")
      {
        Serial.println(F("arma")); // armadillo
      }
      else if (content.substring(1) == "5341004")
      {
        Serial.println(F("astv")); // astro viper
      }
      else if (content.substring(7,2) == "F680E04")
      {
        Serial.println(F("bazt")); // tiger force bazooka
      }
      else if (content.substring(1) == "D411004")
      {
        Serial.println(F("bliz")); // blizzard
      }
      else if (content.substring(1) == "2D91004")
      {
        Serial.println(F("budo")); // budo
      }
      else if (content.substring(1) == "0461004")
      {
        Serial.println(F("ch8")); // charbroil
      }
      else if (content.substring(1) == "6901004")
      {
        Serial.println(F("cray")); // night force crazylegs
      }
      else if (content.substring(1) == "2FB0E04")
      {
        Serial.println(F("des2")); // destro v2 Iron Grenadiers leader
      }
      else if (content.substring(7,2) == "E3F1104")
      {
        Serial.println(F("dukt"));// tiger force duke
      }
      else if (content.substring(7,2) == "C0E1004")
      {
        Serial.println(F("dust"));// tiger force dusty
      }
      else if (content.substring(1) == "9CF1004")
      {
        Serial.println(F("ferr")); // ferret
      }
      else if (content.substring(7,2) == "9FE1004")
      {
        Serial.println(F("flti"));// tiger force flint
      }
      else if (content.substring(1) == "BE41104")
      {
        Serial.println(F("frob")); // tiger force frostbite
      }
      else if (content.substring(1) == "C641004")
      {
        Serial.println(F("gho")); // ghostrider
      }
      else if (content.substring(1) == "2271004")
      {
        Serial.println(F("hard")); // hardball
      }
      else if (content.substring(1) == "51D1104")
      {
        Serial.println(F("hnr")); // hit and run
      }
      else if (content.substring(1) == "1BB1104")
      {
        Serial.println(F("hnr2")); // hit and run v2
      }
      else if (content.substring(1) == "81A1204")
      {
        Serial.println(F("hydrv")); // hydro vipers
      }
      else if (content.substring(1) == "D2B1104")
      {
        Serial.println(F("irng")); // iron grenadiers
      }
      else if (content.substring(1) == "C190F04")
      {
        Serial.println(F("lifet"));// tiger force lifeline
      }
      else if (content.substring(1) == "B7D0E04")
      {
        Serial.println(F("gord")); // lightfoot
      }
      else if (content.substring(1) == "F780F04")
      {
        Serial.println(F("ltf")); // night force  lt falcon v2
      }
      else if (content.substring(1) == "96D1004")
      {
        Serial.println(F("mrat")); // sky patrol static line
      }
      else if (content.substring(1) == "2ED1104")
      {
        Serial.println(F("mrat2")); // muskrat v2
      }
      else if (content.substring(1) == "56D1004")
      {
        Serial.println(F("nul")); // nullifiers
      }
      else if (content.substring(1) == "BBA1104")
      {
        Serial.println(F("ob2"));// night force outback
      }
      else if (content.substring(1) == "E150F04")
      {
        Serial.println(F("sike2")); // night force psyche out
      }
      else if (content.substring(7,2) == "8D235") // 048D2352B7
      {
        Serial.println(F("reco2")); // tiger force recondo
      }
      else if (content.substring(1) == "FDC1004")
      {
        Serial.println(F("repe")); // repeater
      }
      else if (content.substring(7,2) == "D2E1104")
      {
        Serial.println(F("rodp")); // road pig
      }
      else if (content.substring(7,2) == "CC91104")
      {
        Serial.println(F("roadt"));// tiger force roadblock
      }
      else if (content.substring(1) == "1401104")
      {
        Serial.println(F("sectv")); // secto vipers
      }
      else if (content.substring(7,2) == "63B1004")
      {
        Serial.println(F("shwa")); // shockwave
      }
      else if (content.substring(1) == "A1E1004")
      {
        Serial.println(F("skma")); // skidmark
      }
      else if (content.substring(1) == "0771104")
      {
        Serial.println(F("skst")); // skystriker
      }
      else if (content.substring(1) == "74C1004")
      {
        Serial.println(F("sgt3")); // sgt slaughter v3
      }
      else if (content.substring(1) == "5EF0E04")
      {
        Serial.println(F("sne2")); // night force sneak peek
      }
      else if (content.substring(1) == "B551004")
      {
        Serial.println(F("spea")); // spearhead and max
      }
      else if (content.substring(1) == "7E41104")
      {
        Serial.println(F("starv")); // star viper
      }
      else if (content.substring(7,2) == "E271104")
      {
        Serial.println(F("stm2")); // storm shadow v2
      }
      else if (content.substring(1) == "F201104")
      {
        Serial.println(F("stro")); // super trooper
      }
      else if (content.substring(1) == "2BA1004")
      {
        Serial.println(F("toxov")); // toxo vipers
      }
      else if (content.substring(1) == "1901104")
      {
        Serial.println(F("trti")); // tiger force tripwire (v3)
      }
      else if (content.substring(1) == "1001104")
      {
        Serial.println(F("rat2")); // night force tunnel rat 
      }
      else if (content.substring(1) == "0881004")
      {
        Serial.println(F("vol")); // voltar
      }
      else if (content.substring(1) == "C850E04")
      {
        Serial.println(F("vol2")); // voltar 2
      }
      else if (content.substring(1) == "0071104")
      {
        Serial.println(F("wica")); // wildcard
      }
      else if (content.substring(1) == "66D1004")
      {
        Serial.println(F("wimi")); // windmill
      }


      // 1989 (45 cards)
      else if (content.substring(1) == "DD21004")
      {
        Serial.println(F("aerv"));

      }
      else if (content.substring(7, 2) == "32285") //04322852B7
      {
        Serial.println(F("allv")); // alley vipers

      }
      else if (content.substring(1) == "DE41004")
      {
        Serial.println(F("anni"));

      }
      else if (content.substring(1) == "78C0E04")
      {
        Serial.println(F("bac"));

      }
      else if (content.substring(1) == "B511004")
      {
        Serial.println(F("bbq2")); // barbecue v2

      }
      else if (content.substring(1) == "A191004")
      {
        Serial.println(F("charb"));

      }
      else if (content.substring(1) == "DCD1004")
      {
        Serial.println(F("cnt"));

      }
      else if (content.substring(1) == "9191004")
      {
        Serial.println(F("dark")); // darklon

      }
      else if (content.substring(1) == "F301104")
      {
        Serial.println(F("de62"));

      }
      else if (content.substring(1) == "B0B1104")
      {
        Serial.println(F("dj")); // deejay

      }
      else if (content.substring(1) == "03F1004")
      {
        Serial.println(F("dogf"));

      }
      else if (content.substring(1) == "5BD1004")
      {
        Serial.println(F("dwn"));

      }
      else if (content.substring(1) == "E401004")
      {
        Serial.println(F("fut2"));

      }
      else if (content.substring(1) == "DDC0E04")
      {
        Serial.println(F("frgv"));

      }
      else if (content.substring(1) == "C991004")
      {
        Serial.println(F("htv"));

      }
      else if (content.substring(1) == "E021104")
      {
        Serial.println(F("hot"));

      }
      else if (content.substring(1) == "B701004")
      {
        Serial.println(F("lft"));

      }
      else if (content.substring(1) == "B151004")
      {
        Serial.println(F("long1"));

      }
      else if (content.substring(1) == "5FA0E04")
      {
        Serial.println(F("low2"));

      }
      else if (content.substring(1) == "E921004")
      {
        Serial.println(F("musk"));

      }
      else if (content.substring(1) == "54E1004")
      {
        Serial.println(F("mut2"));

      }
      else if (content.substring(1) == "D201104")
      {
        Serial.println(F("naw"));

      }
      else if (content.substring(1) == "BCA1104")
      {
        Serial.println(F("nivi"));

      }
      else if (content.substring(1) == "4171004")
      {
        Serial.println(F("pay2"));

      }
      else if (content.substring(1) == "2F80E04")
      {
        Serial.println(F("pyc"));

      }
      else if (content.substring(1) == "E2B1104")
      {
        Serial.println(F("pyg"));

      }
      else if (content.substring(1) == "14E1004")
      {
        Serial.println(F("pyo"));

      }
      else if (content.substring(1) == "7930E04")
      {
        Serial.println(F("pyt"));

      }
      else if (content.substring(1) == "10C1004")
      {
        Serial.println(F("pytr"));

      }
      else if (content.substring(1) == "69D1104")
      {
        Serial.println(F("pyv"));

      }
      else if (content.substring(1) == "B731004")
      {
        Serial.println(F("ramp"));

      }
      else if (content.substring(1) == "DFB0E04")
      {
        Serial.println(F("reco"));

      }
      else if (content.substring(1) == "D690E04")
      {
        Serial.println(F("rep2"));

      }
      else if (content.substring(1) == "8881004")
      {
        Serial.println(F("rnr2"));

      }
      else if (content.substring(1) == "ACC1104")
      {
        Serial.println(F("scoo"));

      }
      else if (content.substring(1) == "98A0E04")
      {
        Serial.println(F("shoc"));

      }
      else if (content.substring(1) == "3901004")
      {
        Serial.println(F("snk3"));

      }
      else if (content.substring(1) == "0590E04")
      {
        Serial.println(F("snm"));

      }
      else if (content.substring(1) == "9321004")
      {
        Serial.println(F("spi2"));

      }
      else if (content.substring(1) == "00D1104")
      {
        Serial.println(F("smau"));

      }
      else if (content.substring(1) == "A591004")
      {
        Serial.println(F("s89"));

      }
      else if (content.substring(1) == "7181004")
      {
        Serial.println(F("targ"));

      }
      else if (content.substring(1) == "CC51004")
      {
        Serial.println(F("tvi"));

      }
      else if (content.substring(1) == "F8F1004")
      {
        Serial.println(F("wbo"));

      }
      else if (content.substring(1) == "F861004")
      {
        Serial.println(F("win"));

      }

      // 1990-1994 Figures (incomplete collection)
      else if (content.substring(1) == "3D 2E 11 04")
      {
        r = 0;
        yoJoe(r); //ambush
      }
      else if (content.substring(1) == "BC81004")
      {
        r = 1;
        yoJoe(r); //astro viper93
      }
      else if (content.substring(1) == "78B1104")
      {
        r = 2;
        yoJoe(r); //baat
      }
      else if (content.substring(1) == "AFF1004")
      {
        r = 3;
        yoJoe(r); //big ben
      }
      else if (content.substring(1) == "5BD1004")
      {
        r = 4;
        yoJoe(r); //cobra commander92
      }
      else if (content.substring(1) == "DB51104")
      {
        r = 5;
        yoJoe(r); //cobra commanderV4
      }
      else if (content.substring(1) == "AAF1004")
      {
        r = 6;
        yoJoe(r); //cesspool
      }
      else if (content.substring(1) == "0B00E04")
      {
        r = 7;
        yoJoe(r); //countdown93
      }
      else if (content.substring(1) == "9901104")
      {
        r = 8;
        yoJoe(r); //crimson guard immortal
      }
      else if (content.substring(1) == "6CF1004")
      {
        r = 9;
        yoJoe(r); //deepsix93
      }
      else if (content.substring(1) == "B371004")
      {
        r = 10;
        yoJoe(r); //desert scorpion
      }
      else if (content.substring(1) == "5021204")
      {
        r = 11;
        yoJoe(r); //freefall
      }
      else if (content.substring(1) == "C041004")
      {
        r = 12;
        yoJoe(r); //gen flagg
      }
      else if (content.substring(1) == "CCF1004")
      {
        r = 13;
        yoJoe(r); //genhawk94?
      }
      else if (content.substring(1) == "C801004")
      {
        r = 14;
        yoJoe(r); //gen hawk92
      }
      else if (content.substring(1) == "3C31004")
      {
        r = 15;
        yoJoe(r); //GI Colton
      }
      else if (content.substring(1) == "EFC0D04")
      {
        r = 16;
        yoJoe(r); //headhunter
      }
      else if (content.substring(1) == "FB71004")
      {
        r = 17;
        yoJoe(r); //headman
      }
      else if (content.substring(1) == "6DC1004")
      {
        r = 18;
        yoJoe(r); //interrogator
      }
      else if (content.substring(1) == "1A81104")
      {
        r = 19;
        yoJoe(r); //laser viper
      }
      else if (content.substring(1) == "8091004")
      {
        r = 20;
        yoJoe(r); //lowlightV3
      }
      else if (content.substring(1) == "4641004")
      {
        r = 21;
        yoJoe(r); //lt falcon92
      }
      else if (content.substring(1) == "EAD1004")
      {
        r = 22;
        yoJoe(r); //major storm
      }
      else if (content.substring(1) == "DDA0E04")
      {
        r = 23;
        yoJoe(r); //mercer v2
      }
      else if (content.substring(1) == "F791104")
      {
        r = 24;
        yoJoe(r); //overlord
      }
      else if (content.substring(1) == "6310F04")
      {
        r = 25;
        yoJoe(r); //range viper
      }
      else if (content.substring(1) == "17D1104")
      {
        r = 26;
        yoJoe(r); //red star
      }
      else if (content.substring(1) == "44B1004")
      {
        r = 27;
        yoJoe(r); //shadow92
      }
      else if (content.substring(1) == "E211004")
      {
        r = 28;
        yoJoe(r); //shipwreck94
      }
      else if (content.substring(1) == "16C1004")
      {
        r = 29;
        yoJoe(r); //snake4
      }
      else if (content.substring(1) == "7121204")
      {
        r = 30;
        yoJoe(r); //stalker94
      }
      else if (content.substring(1) == "31B1204")
      {
        r = 31; //vulture
        yoJoe(r);
      }
      else if (content.substring(1) == "F5E1004")
      {
        s = 0; // skymate
        cobra(s);
      }
      else if (content.substring(1) == "99C1104")
      {
        s = 1; // skycreeper
        cobra(s);
      }
      else if (content.substring(1) == "3820E04")
      {
        s = 2; // cloudburst
        cobra(s);
      }
      else if (content.substring(1) == "9371004")
      {
        s = 3; // major altitude
        cobra(s);
      }
      else if (content.substring(1) == "F8C1104")
      {
        s = 4; // tracker
        cobra(s);
      }
      else if (content.substring(1) == "6AC0E04")
      {
        s = 5; // heavy duty
        cobra(s);
      }
      else if (content.substring(1) == "2CC0E04")
      {
        s = 6; // bat 92
        cobra(s);
      }
      else if (content.substring(1) == "A5E1004")
      {
        s = 7; // metalhead
        cobra(s);
      }


      /*
                  //   VEHICLES


                  //1982
                  else if (content.substring(1) == "A171004")
                  {
                    if (veh == true) {
                      Serial.println(F("flakf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("flakb"));

                    }
                  }
                  else if (content.substring(1) == "4881004")
                  {
                    if (veh == true) {
                      Serial.println(F("half"));

                    }
                    else if (veh == false) {
                      Serial.println(F("halb"));

                    }
                  }
                  else if (content.substring(1) == "B731004")
                  {
                    if (veh == true) {
                      Serial.println(F("jumpf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("jumpb"));

                    }
                  }
                  else if (content.substring(1) == "3A01004")
                  {
                    if (veh == true) {
                      Serial.println(F("mmsf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("mmsb"));

                    }
                  }
                  else if (content.substring(1) == "3231004")
                  {
                    if (veh == true) {
                      Serial.println(F("mobatf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("mobatb"));

                    }
                  }
                  else if (content.substring(1) == "93F1004")
                  {
                    if (veh == true) {
                      Serial.println(F("ramf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("ramb"));

                    }
                  }

                  //1983 Vehicles
                  else if (content.substring(1) == "D7E1004")
                  {
                    if (veh == true) {
                      Serial.println(F("dfA"));

                    }
                    else if (veh == false) {
                      Serial.println(F("dfB"));

                    }
                  }
                  else if (content.substring(1) == "C1B1004")
                  {
                    if (veh == true) {
                      Serial.println(F("apcF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("apcB"));

                    }
                  }
                  else if (content.substring(1) == "2971004")
                  {
                    if (veh == true) {
                      Serial.println(F("cglF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("cglB"));

                    }
                  }
                  else if (content.substring(1) == "51B0E04")
                  {
                    if (veh == true) {
                      Serial.println(F("fangF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("fangB"));

                    }
                  }
                  else if (content.substring(1) == "5160E04")
                  {
                    if (veh == true) {
                      Serial.println(F("glF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("glB"));

                    }
                  }
                  else if (content.substring(1) == "6D71004")
                  {
                    if (veh == true) {
                      Serial.println(F("hissF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("hissB"));

                    }
                  }
                  else if (content.substring(1) == "D661104")
                  {
                    if (veh == true) {
                      Serial.println(F("hqF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("hqB"));

                    }
                  }
                  else if (content.substring(1) == "0791004")
                  {
                    if (veh == true) {
                      Serial.println(F("pacF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("pacB"));

                    }
                  }
                  else if (content.substring(1) == "9361004")
                  {
                    if (veh == true) {
                      Serial.println(F("pac2F"));

                    }
                    else if (veh == false) {
                      Serial.println(F("pac2B"));

                    }
                  }
                  else if (content.substring(1) == "C791004")
                  {
                    if (veh == true) {
                      Serial.println(F("pac3F"));

                    }
                    else if (veh == false) {
                      Serial.println(F("pac3B"));

                    }
                  }
                  else if (content.substring(1) == "C101104")
                  {
                    if (veh == true) {
                      Serial.println(F("polF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("polB"));

                    }
                  }
                  else if (content.substring(1) == "30D1204")
                  {
                    if (veh == true) {
                      Serial.println(F("skyF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("skyB"));

                    }
                  }
                  else if (content.substring(1) == "D171004")
                  {
                    if (veh == true) {
                      Serial.println(F("snkF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("snkB"));

                    }
                  }
                  else if (content.substring(1) == "9201004")
                  {
                    if (veh == true) {
                      Serial.println(F("whF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("whB"));

                    }
                  }
                  else if (content.substring(1) == "1780F04")
                  {
                    if (veh == true) {
                      Serial.println(F("wolF"));

                    }
                    else if (veh == false) {
                      Serial.println(F("wolB"));

                    }
                  }

                  // 84 vehicles (15 vehicles)
                  else if (content.substring(1) == "5C81004")
                  {
                    if (veh == true) {
                      Serial.println(F("aspf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("aspb"));

                    }
                  }
                  else if (content.substring(1) == "E061004")
                  {
                    if (veh == true) {
                      Serial.println(F("bif"));

                    }
                    else if (veh == false) {
                      Serial.println(F("bib"));

                    }
                  }
                  else if (content.substring(1) == "D931004")
                  {
                    if (veh == true) {
                      Serial.println(F("chaf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("chab"));

                    }
                  }
                  else if (content.substring(1) == "D171004")
                  {
                    if (veh == true) {
                      Serial.println(F("clawf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("clawb"));

                    }
                  }
                  else if (content.substring(1) == "D691104")
                  {
                    if (veh == true) {
                      Serial.println(F("hof"));

                    }
                    else if (veh == false) {
                      Serial.println(F("hob"));

                    }
                  }
                  else if (content.substring(1) == "DC10E04")
                  {
                    if (veh == true) {
                      Serial.println(F("rattf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("rattb"));

                    }
                  }
                  else if (content.substring(1) == "60C1004")
                  {
                    if (veh == true) {
                      Serial.println(F("shaf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("shab"));

                    }
                  }
                  else if (content.substring(1) == "BEF1004")
                  {
                    if (veh == true) {
                      Serial.println(F("skyhf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("skyhb"));

                    }
                  }
                  else if (content.substring(1) == "0EA1104")
                  {
                    if (veh == true) {
                      Serial.println(F("sluf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("slub"));

                    }
                  }
                  else if (content.substring(1) == "27F1004")
                  {
                    if (veh == true) {
                      Serial.println(F("stif"));

                    }
                    else if (veh == false) {
                      Serial.println(F("stib"));

                    }
                  }
                  else if (content.substring(1) == "4B31004")
                  {
                    if (veh == true) {
                      Serial.println(F("vamf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("vamb"));

                    }
                  }
                  else if (content.substring(1) == "C2B1104")
                  {
                    if (veh == true) {
                      Serial.println(F("vamhf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("vamhb"));

                    }
                  }
                  else if (content.substring(1) == "00D1004")
                  {
                    if (veh == true) {
                      Serial.println(F("watf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("watb"));

                    }
                  }
                  else if (content.substring(1) == "B5C1004")
                  {
                    if (veh == true) {
                      Serial.println(F("whatf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("whatb"));

                    }
                  }
                  else if (content.substring(1) == "E2D1004")
                  {
                    if (veh == true) {
                      Serial.println(F("wtb"));

                    }
                    else if (veh == false) {
                      Serial.println(F("wtf"));

                    }
                  }

                  // 1985 Vehicles (23)
                  else if (content.substring(1) == "5871004")
                  {
                    if (veh == true) {
                      Serial.println(F("adbf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("adbb"));

                    }
                  }
                  else if (content.substring(1) == "A021104")
                  {
                    if (veh == true) {
                      Serial.println(F("aduf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("adub"));

                    }
                  }
                  else if (content.substring(1) == "45B0E04")
                  {
                    if (veh == true) {
                      Serial.println(F("arf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("arb"));

                    }
                  }
                  else if (content.substring(1) == "D1F1004")
                  {
                    if (veh == true) {
                      Serial.println(F("awf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("awb"));

                    }
                  }
                  else if (content.substring(1) == "1811004")
                  {
                    if (veh == true) {
                      Serial.println(F("bdf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("bdb"));

                    }
                  }
                  else if (content.substring(1) == "6761004")
                  {
                    if (veh == true) {
                      Serial.println(F("blf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("blb"));

                    }
                  }
                  else if (content.substring(1) == "D071104")
                  {
                    if (veh == true) {
                      Serial.println(F("catf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("catb"));

                    }
                  }
                  else if (content.substring(1) == "9AA1004")
                  {
                    if (veh == true) {
                      Serial.println(F("cbf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("cbb"));

                    }
                  }
                  else if (content.substring(1) == "A5E1104")
                  {
                    if (veh == true) {
                      Serial.println(F("cpf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("cpb"));

                    }
                  }
                  else if (content.substring(1) == "94E0F04")
                  {
                    if (veh == true) {
                      Serial.println(F("crrf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("crrb"));

                    }
                  }
                  else if (content.substring(1) == "3721104")
                  {
                    if (veh == true) {
                      Serial.println(F("ferf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("ferb"));

                    }
                  }
                  else if (content.substring(1) == "0031104")
                  {
                    if (veh == true) {
                      Serial.println(F("flaggf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("flaggb"));

                    }
                  }
                  else if (content.substring(1) == "78B1004")
                  {
                    if (veh == true) {
                      Serial.println(F("fof"));

                    }
                    else if (veh == false) {
                      Serial.println(F("fob"));

                    }
                  }
                  else if (content.substring(1) == "94C1104")
                  {
                    if (veh == true) {
                      Serial.println(F("mbtf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("mbtb"));

                    }
                  }
                  else if (content.substring(1) == "E401004")
                  {
                    if (veh == true) {
                      Serial.println(F("mof"));

                    }
                    else if (veh == false) {
                      Serial.println(F("mob"));

                    }
                  }
                  else if (content.substring(1) == "8231004")
                  {
                    if (veh == true) {
                      Serial.println(F("nlf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("nlb"));

                    }
                  }
                  else if (content.substring(1) == "1161004")
                  {
                    if (veh == true) {
                      Serial.println(F("scf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("scb"));

                    }
                  }
                  else if (content.substring(1) == "61D0F04")
                  {
                    if (veh == true) {
                      Serial.println(F("smf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("smb"));

                    }
                  }
                  else if (content.substring(1) == "1701104")
                  {
                    if (veh == true) {
                      Serial.println(F("smsf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("smsb"));

                    }
                  }
                  else if (content.substring(1) == "BB41104")
                  {
                    if (veh == true) {
                      Serial.println(F("snv2f"));

                    }
                    else if (veh == false) {
                      Serial.println(F("snv2b"));

                    }
                  }
                  else if (content.substring(1) == "E7C1004")
                  {
                    if (veh == true) {
                      Serial.println(F("tbf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("tbb"));

                    }
                  }
                  else if (content.substring(1) == "8E41004")
                  {
                    if (veh == true) {
                      Serial.println(F("ttbf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("ttbb"));

                    }
                  }
                  else if (content.substring(1) == "3911004")
                  {
                    if (veh == true) {
                      Serial.println(F("wetf"));

                    }
                    else if (veh == false) {
                      Serial.println(F("wetb"));

                    }
                  }

                  // 1986 vehicles (18 tags/vehicles)
                  else if (content.substring(1) == "5471004")
                  {
                    if (veh == true) {
                      i = 0;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 1;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "17D1104")
                  {
                    if (veh == true) {
                      i = 2;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 3;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "D2F1104")
                  {
                    if (veh == true) {
                      i = 4;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 5;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "3D51004")
                  {
                    if (veh == true) {
                      i = 6;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 7;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "A7A1104")
                  {
                    if (veh == true) {
                      i = 8;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 9;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "0461004")
                  {
                    if (veh == true) {
                      i = 10;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 11;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "3071004")
                  {
                    if (veh == true) {
                      i = 12;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 13;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "7191204")
                  {
                    if (veh == true) {
                      i = 14;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 15;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "8881004")
                  {
                    if (veh == true) {
                      i = 16;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 17;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "9A71004")
                  {
                    if (veh == true) {
                      i = 18;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 19;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "BD21104")
                  {
                    if (veh == true) {
                      i = 20;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 21;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "EA20F04")
                  {
                    if (veh == true) {
                      i = 22;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 23;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "7D11704")
                  {
                    if (veh == true) {
                      i = 24;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 25;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "8530F04")
                  {
                    if (veh == true) {
                      i = 26;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 27;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "EBD0E04")
                  {
                    if (veh == true) {
                      i = 28;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 29;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "B340F04")
                  {
                    if (veh == true) {
                      i = 30;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 31;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "70E0F04")
                  {
                    if (veh == true) {
                      i = 32;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 33;
                      cache86(i);
                    }
                  }
                  else if (content.substring(1) == "ACE1104")
                  {
                    if (veh == true) {
                      i = 34;
                      cache86(i);
                    }
                    else if (veh == false) {
                      i = 35;
                      cache86(i);
                    }
                  }


                  // 1987 vehicles (16 tags)
                  else if (content.substring(1) == "08D1004")
                  {
                    if (veh == true) {
                      j = 0;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 1;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "F821104")
                  {
                    if (veh == true) {
                      j = 2;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 3;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "D140F04")
                  {
                    if (veh == true) {
                      j = 4;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 5;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "EB71004")
                  {
                    if (veh == true) {
                      j = 6;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 7;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "CAA1004")
                  {
                    if (veh == true) {
                      j = 8;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 9;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "33A1004")
                  {
                    if (veh == true) {
                      j = 10;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 11;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "31E1004")
                  {
                    if (veh == true) {
                      j = 12;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 13;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "F281104")
                  {
                    if (veh == true) {
                      j = 14;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 15;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "B081004")
                  {
                    if (veh == true) {
                      j = 16;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 17;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "FFA0E04")
                  {
                    if (veh == true) {
                      j = 18;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 19;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "1481004")
                  {
                    if (veh == true) {
                      j = 20;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 21;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "F201104")
                  {
                    if (veh == true) {
                      j = 22;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 23;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "0EA1104")
                  {
                    if (veh == true) {
                      j = 24;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 25;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "23B1104")
                  {
                    if (veh == true) {
                      j = 26;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 27;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "3341004")
                  {
                    if (veh == true) {
                      j = 28;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 29;
                      cache87(j);
                    }
                  }
                  else if (content.substring(1) == "A371004")
                  {
                    if (veh == true) {
                      j = 30;
                      cache87(j);
                    }
                    else if (veh == false) {
                      j = 31;
                      cache87(j);
                    }
                  }

                  // 1988 vehicles (12 tags)

                  else if (content.substring(1) == "0641104")
                  {
                    if (veh == true) {
                      k = 0;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 1;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "F0A1104")
                  {
                    if (veh == true) {
                      k = 2;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 3;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "13B0E04")
                  {
                    if (veh == true) {
                      k = 4;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 5;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "CCA1104")
                  {
                    if (veh == true) {
                      k = 6;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 7;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "2920F04")
                  {
                    if (veh == true) {
                      k = 8;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 9;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "0CE1004")
                  {
                    if (veh == true) {
                      k = 10;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 11 ;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "BE80E04")
                  {
                    if (veh == true) {
                      k = 12 ;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 13;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "3881004")
                  {
                    if (veh == true) {
                      k = 14;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 15;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "F101104")
                  {
                    if (veh == true) {
                      k = 16;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 17;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "8670F04")
                  {
                    if (veh == true) {
                      k = 18;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 19;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "CE90E04")
                  {
                    if (veh == true) {
                      k = 20;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 21;
                      cache88(k);
                    }
                  }
                  else if (content.substring(1) == "54A1004")
                  {
                    if (veh == true) {
                      k = 22;
                      cache88(k);
                    }
                    else if (veh == false) {
                      k = 23;
                      cache88(k);
                    }
                  }


                  // 1989 vehicles (7 tags)
                  else if (content.substring(1) == "A021004")
                  {
                    if (veh == true) {
                      l = 0;
                      cache89(l);
                    }
                    else if (veh == false) {
                      l = 1;
                      cache89(l);
                    }
                  }
                  else if (content.substring(1) == "1361004")
                  {
                    if (veh == true) {
                      l = 2;
                      cache89(l);
                    }
                    else if (veh == false) {
                      l = 3;
                      cache89(l);
                    }
                  }
                  else if (content.substring(1) == "3B51104")
                  {
                    if (veh == true) {
                      l = 4;
                      cache89(l);
                    }
                    else if (veh == false) {
                      l = 5;
                      cache89(l);
                    }
                  }
                  else if (content.substring(1) == "A291104")
                  {
                    if (veh == true) {
                      l = 6;
                      cache89(l);
                    }
                    else if (veh == false) {
                      l = 7;
                      cache89(l);
                    }
                  }
                  else if (content.substring(1) == "2D41004")
                  {
                    if (veh == true) {
                      l = 8;
                      cache89(l);
                    }
                    else if (veh == false) {
                      l = 9;
                      cache89(l);
                    }
                  }
                  else if (content.substring(1) == "1031004")
                  {
                    if (veh == true) {
                      l = 10;
                      cache89(l);
                    }
                    else if (veh == false) {
                      l = 11;
                      cache89(l);
                    }
                  }
                  else if (content.substring(1) == "9D31004")
                  {
                    if (veh == true) {
                      l = 12;
                      cache89(l);
                    }
                    else if (veh == false) {
                      l = 13;
                      cache89(l);
                    }
                  }


                  // 1990 vehicles (10 tags)
                  else if (content.substring(1) == "2181004")
                  {
                    if (veh == true) {
                      m = 0;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 1;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "1580E04")
                  {
                    if (veh == true) {
                      m = 2;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 3;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "D2D1104")
                  {
                    if (veh == true) {
                      m = 4;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 5;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "C840E04")
                  {
                    if (veh == true) {
                      m = 6;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 7;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "7531004")
                  {
                    if (veh == true) {
                      m = 8;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 9;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "7111204")
                  {
                    if (veh == true) {
                      m = 10;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 11;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "91F1004")
                  {
                    if (veh == true) {
                      m = 12;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 13;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "2391004")
                  {
                    if (veh == true) {
                      m = 14;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 15;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "D591104")
                  {
                    if (veh == true) {
                      m = 16;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 17;
                      cache90(m);
                    }
                  }
                  else if (content.substring(1) == "2331004")
                  {
                    if (veh == true) {
                      m = 18;
                      cache90(m);
                    }
                    else if (veh == false) {
                      m = 19;
                      cache90(m);
                    }
                  }


                  // 1991 vehicles (3 tags)
                  else if (content.substring(1) == "95E1004")
                  {
                    if (veh == true) {
                      n = 0;
                      cache91(n);
                    }
                    else if (veh == false) {
                      n = 1;
                      cache91(n);
                    }
                  }
                  else if (content.substring(1) == "A4E1004")
                  {
                    if (veh == true) {
                      n = 2;
                      cache91(n);
                    }
                    else if (veh == false) {
                      n = 3;
                      cache91(n);
                    }
                  }
                  else if (content.substring(1) == "9441104")
                  {
                    if (veh == true) {
                      n = 4;
                      cache91(n);
                    }
                    else if (veh == false) {
                      n = 5;
                      cache91(n);
                    }
                  }


                  // 1992 vehicles (3 tags)
                  else if (content.substring(1) == "A591004")
                  {
                    if (veh == true) {
                      o = 0;
                      cache92(o);
                    }
                    else if (veh == false) {
                      o = 1;
                      cache92(o);
                    }
                  }
                  else if (content.substring(1) == "3001104")
                  {
                    if (veh == true) {
                      o = 2;
                      cache92(o);
                    }
                    else if (veh == false) {
                      o = 3;
                      cache92(o);
                    }
                  }
                  else if (content.substring(1) == "8071004")
                  {
                    if (veh == true) {
                      o = 4;
                      cache92(o);
                    }
                    else if (veh == false) {
                      o = 5;
                      cache92(o);
                    }
                  }


                  // 1993 vehicles (4 tags)
                  else if (content.substring(1) == "4570E04")
                  {
                    if (veh == true) {
                      p = 0;
                      cache93(p);
                    }
                    else if (veh == false) {
                      p = 1;
                      cache93(p);
                    }
                  }
                  else if (content.substring(1) == "25F1004")
                  {
                    if (veh == true) {
                      p = 2;
                      cache93(p);
                    }
                    else if (veh == false) {
                      p = 3;
                      cache93(p);
                    }
                  }
                  else if (content.substring(1) == "4041004")
                  {
                    if (veh == true) {
                      p = 4;
                      cache93(p);
                    }
                    else if (veh == false) {
                      p = 5;
                      cache93(p);
                    }
                  }
                  else if (content.substring(1) == "5180E04")
                  {
                    if (veh == true) {
                      p = 6;
                      cache93(p);
                    }
                    else if (veh == false) {
                      p = 7;
                      cache93(p);
                    }
                  }


                  // 1994 vehicles (4 tags)
                  else if (content.substring(1) == "DB61004")
                  {
                    if (veh == true) {
                      q = 0;
                      cache94(q);
                    }
                    else if (veh == false) {
                      q = 1;
                      cache94(q);
                    }
                  }
                  else if (content.substring(1) == "8AA0E04")
                  {
                    if (veh == true) {
                      q = 2;
                      cache94(q);
                    }
                    else if (veh == false) {
                      q = 3;
                      cache94(q);
                    }
                  }
                  else if (content.substring(1) == "C54C1004")
                  {
                    if (veh == true) {
                      q = 4;
                      cache94(q);
                    }
                    else if (veh == false) {
                      q = 5;
                      cache94(q);
                    }
                  }
                  else if (content.substring(1) == "3971004")
                  {
                    if (veh == true) {
                      q = 6;
                      cache94(q);
                    }
                    else if (veh == false) {
                      q = 7;
                      cache94(q);
                    }
                  }
                  // 84 playsets (added at end)
                  else if (content.substring(1) == "9031204")
                  {
                    if (veh == true) {
                      t = 0; // 84 mortar defense unit
                      playsets(t);
                    }
                    else if (veh == false) {
                      t = 1;
                      playsets(t);

                    }
                  }
                  else if (content.substring(1) == "21A1004")
                  {
                    if (veh == true) {
                      t = 2; // 84 machine gun defense unit
                      playsets(t);
                    }
                    else if (veh == false) {
                      t = 3;
                      playsets(t);
                    }
                  }
                  else if (content.substring(1) == "B6A0E04")
                  {
                    if (veh == true) {
                      t = 4; // 84 missile defense unit
                      playsets(t);
                    }
                    else if (veh == false) {
                      t = 5;
                      playsets(t);
                    }
                  }
                  else if (content.substring(1) == "1261004")
                  {
                    if (veh == true) {
                      t = 6; // 84 watchtower
                      playsets(t);
                    }
                    else if (veh == false) {
                      t = 7;
                      playsets(t);
                    }
                  }
                  else if (content.substring(1) == "16A1004")
                  {
                    if (veh == true) {
                      t = 8; // 84 mountain howitzer
                      playsets(t);
                    }
                    else if (veh == false) {
                      t = 9;
                      playsets(t);
                    }
                  }
                  // 1990 vehicles part 2
                  else if (content.substring(1) == "44DFB3C")
                  {
                    if (veh == true) {
                      u = 0; // cobra rage
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 1;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "449FB3C")
                  {
                    if (veh == true) {
                      u = 2; // hurricane vtol
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 3;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "BFDFA3C")
                  {
                    if (veh == true) {
                      u = 4; // locust
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 5;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "E6CFB3C")
                  {
                    if ((veh == true) && (tristate == true)) {
                      tristate = false;
                      u = 8; // retaliator pilot updraft
                      neon(u);
                    }
                    else if ((veh == true) && (tristate == false)) {
                      tristate = true;
                      u = 6; // retaliator
                      neon(u);
                    }
                    else if ((veh == false) && (tristate == true)) {
                      u = 7;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "AA6FB3C")
                  {

                    if (veh == true) {
                      u = 9; // desert apache
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 10;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "C600E04")
                  {
                    if (veh == true) {
                      u = 11; // attack cruiser
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 12;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "46DFB3C")
                  {
                    if (veh == true) {
                      u = 13; //  brawler
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 14;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "B77FB3C")
                  {
                    if (veh == true) {
                      u = 15; // ice sabre
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 16;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "F47FB3C")
                  {
                    if (veh == true) {
                      u = 17; // paralyzer
                      neon(u);
                    }
                    else if (veh == false) {
                      u = 18;
                      neon(u);
                    }
                  }
                  else if (content.substring(1) == "213FB3C")// 19 20 21
                  {
                    if ((veh == true) && (tristate == true)) {
                      tristate = false;
                      u = 19; // air commandos cloudburst
                      neon(u);
                    }
                    else if ((veh == true) && (tristate == false)) { // Air Commandos Cloudburst back
                      tristate = true;
                      u = 20;
                      neon(u);
                    }
                    else if ((veh == false) && (tristate == true)) {
                      u = 21; // Cloudburst file card
                      neon(u); // h9
                    }
                  }
                  else if (content.substring(1) == "15DFB3C")
                  {
                    if (veh == true) {
                      u = 22; // air commandos night vulture
                      neon(u); // i1
                    }

                    else if (veh == false) {
                      u = 23; // night vulture file card
                      neon(u); // i2
                    }
                  }
                  else if (content.substring(1) == "74BFB3C")
                  {
                    if (veh == true) {
                      u = 24; // air commandos sky creeper
                      neon(u); // i3
                    }

                    else if (veh == false) {
                      u = 25; //  sky creeper file card
                      neon(u); // i4
                    }
                  }
                  else if (content.substring(1) == "AC4FB3C")
                  {
                    if (veh == true) {
                      u = 26; // air commandos skymate
                      neon(u); // i5
                    }

                    else if (veh == false) {
                      u = 27; // skymate file card
                      neon(u); // i6
                    }
                  }
                  else if (content.substring(1) == "79AFB3C")
                  {
                    u = 28; //
                    neon(u);
                  }
                  else if (content.substring(1) == "34FFB3C")
                  {
                    u = 29; //
                    neon(u);
                  }
                  else if (content.substring(1) == "0F90D04")
                  {
                    u = 30; //
                    neon(u);
                  }
                  else if (content.substring(1) == "68E0E04")
                  {
                    u = 31; //
                    neon(u);
                  }
                  else if (content.substring(1) == "0EFFA3C")
                  {
                    u = 32; //
                    neon(u);
                  }
                  else if (content.substring(1) == "4B6FB3C")
                  {
                    u = 33; //
                    neon(u);
                  }
                  else if (content.substring(1) == "F16FB3C")
                  {
                    u = 34; //
                    neon(u);
                  }
                  else if (content.substring(1) == "F05FB3C")
                  {
                    u = 35; //
                    neon(u);
                  }
      */

      else   {
        Serial.println("intruder");
      }
      if (veh == true) {
        lastv = veh;
      }
      delay(1000);
      veh = !veh; // flip the vehicle card toggle
      lastString = content.substring(1);
      break;

    case true:
      break;
  }
}

void cache86(byte i) {
  strcpy_P(buffer, (char *)pgm_read_word(&(eightsix[i])));
  Serial.println(buffer);
}
void cache87(byte j) {
  strcpy_P(buffer, (char *)pgm_read_word(&(eightseven[j])));
  Serial.println(buffer);
}

void cache88(byte k) {
  strcpy_P(buffer, (char *)pgm_read_word(&(eighteight[k])));
  Serial.println(buffer);
}
void cache89(byte l) {
  strcpy_P(buffer, (char *)pgm_read_word(&(eightnine[l])));
  Serial.println(buffer);
}
void cache90(byte m) {
  strcpy_P(buffer, (char *)pgm_read_word(&(ninety[m])));
  Serial.println(buffer);
}
void cache91(byte n) {
  strcpy_P(buffer, (char *)pgm_read_word(&(nineone[n])));
  Serial.println(buffer);
}
void cache92(byte o) {
  strcpy_P(buffer, (char *)pgm_read_word(&(ninetwo[o])));
  Serial.println(buffer);
}
void cache93(byte p) {
  strcpy_P(buffer, (char *)pgm_read_word(&(ninethree[p])));
  Serial.println(buffer);
}

void cache94(byte q) {
  strcpy_P(buffer, (char *)pgm_read_word(&(ninefour[q])));
  Serial.println(buffer);
}
void yoJoe(byte r) {
  strcpy_P(buffer, (char *)pgm_read_word(&(nineties[r])));
  Serial.println(buffer);
}
void cobra (byte s) {
  strcpy_P(buffer, (char *)pgm_read_word(&(lastones[s])));
  Serial.println(buffer);
}
void playsets(byte t) {
  strcpy_P(buffer, (char *)pgm_read_word(&(uzis[t])));
  Serial.println(buffer);
}
void neon(byte u) {
  strcpy_P(buffer, (char *)pgm_read_word(&(ninetyPtTwo[u])));
  Serial.println(buffer);
}

void threefigs(byte z) {
  strcpy_P(buffer, (char *)pgm_read_word(&(threezies[z])));
  Serial.println(buffer);
}
void fourfigs(byte y) {
  strcpy_P(buffer, (char *)pgm_read_word(&(fourzies[y])));
  Serial.println(buffer);
}

Cool! I like that sprinklers project (and the other one is...fun too... :joy:).
Question: how do you get your wires and such looking so neat in Wokwi? Whenever I make a Wokwi my wires look like a preschool spaghetti buffet.

Click on the device and move it with the KEYBOARD to snap to grid. Wires, click and drag with a mouse (they will snap to grid ).

Just like code; make one good set, and copy/paste the others (either the graphic devices or the text in diagram.json).

1 Like

Do you use String in your sketch? As opposed to c-strings (char myString[10] = "blabla";)?
Use of String can quickly eat your dynamic memory as it leaves holes in the heap...

If the code not completed and you are going to extend it further... and have a memory problems already - the good advice should be to change the board to one with much RAM

1 Like

SRAM:

  • F-Makro was already mentioned, use it for most of your .print() / .println() - but not for the Ethernet client if it is used at all
  • check EACH used variable to have it's correct variable type. Not every variable needs to be a 2 byte int. Lot of variables can be hold in a byte. Some of the floats can be replaced by fix comma arithmetic.
  • If you have lot of constant variables / arrays like for mapping, binary data, fonts, ... use PROGMEM
  • take care of variable type of your arrays. If you use the wrong (to large) variable type for an array, you waist memory multiplied by the size of the array. Also check multidimensional arrays if they really hold the same kind of data or if a structure of array is more suitable.
  • get rid of global variables as much as you can and use local variables. By the way the 1857 bytes are only the GLOBAL variables, depending on your used libraries and programming you might need a lot more SRAM for local variables also.
  • help the compiler to optimize your code and mark not changing variables as const or even constexpr

Program Memory:

  • check for duplicated code - program lines which very similar code and use functions to replace duplicated code
  • if you have a mixture of SPI and I2C sensors, go either the SPI or the I2C way and try to get rid of one bus.

you should read this article from Adafruit:

I guess when some of us can see the code - you might get several hints more.

1 Like

Does the output not state that you're low on memory? The IDE only reports on memory that is known at compile time.

There are a few things that you need to understand.

Each time you call a function, the return address is placed on the stack. You seem to be compiling for a 328P processor (e.g. Uno or Nano). So the (hidden for you) main() function calls setup(); two bytes down the drain and once setup() is finished they are available again. Same for loop().

Now in loop() you call another function and from there another function. So a total of 6 bytes down the drain; each time a function ends the two bytes become available again.

Now in this functions you use some local variables; those also take space and will become available again when the function finishes.

If you pass parameters to a function, they might also be passed on the stack (though I think it is usually registers).

Interrupts are a different story; the return address is placed on the stack; all variables that are in registers are also placed on the stack so they don't get corrupted. This also costs space. All of this will become available again when the interrupt finishes.

And lastly dynamic memory allocation which will allocate space on the heap and is not known at compile time.

Read up on heap and stack.

@noiasca already referred to an article about memory, here is another one: https://docs.arduino.cc/learn/programming/memory-guide/. I suggest that you sprinkle your code with calls to the display_freeram() from measuring memory usage in arduino boards (the Adafruit version has a bug) and see what is going on.

I understand it's much better to share to code and believe me if I could I would, we are just not allowed to share any ongoing university projects and I was in dire need of help..... Nontheless thank you for sharing your projects haha I will surely look into them after I finish this one :slight_smile:

I decided to search through the forum some more now that I was sure that the problem with my project was dynamic memory and found just that about the F macro. Now it's working much better! But I still have much code to write so i will have to be cautious lol... Thank you!

That GI Joe project looks really cool! And yes I had a bunch of lcd.print(".....") statements and moving the string literals to flash memory helped a lot! Thanks! And the program memory didn't budge at all with it

1 Like

I have just a single String remaining, but I'll try to replace it with a c-string soon, all the rest of my strings are c-strings. Thanks for the suggestion :slight_smile:

Thanks a lot for your suggestions! Your message was extremely helpful :slight_smile:

Output does not state I'm low on memory, this is my first project and I had no idea what was going on lol, all of the components just started acting super weird all of a sudden....

Thank you so much for your advice!

I've recently been working on a project where I wanted to keep an eye on its memory usage. You may find the information in the attached pdf useful. I see from your memory size image that you are using something with 2K RAM and 32K ROM. I'm guessing it's a nano or uno, if that's correct then the info in the pdf about RAM size, start, and end should exactly match your processor. If asked, I could quickly make an almost empty sketch as an example of how to use the FreeRam class shown in the pdf.
Displaying Information about Nano RAM Usage.pdf (1.0 MB)

1 Like
  1. Which board are you compiling for?
  2. Which version of the IDE? If you're using Linux, be aware that the version that is in the package manager is an antique version (and I mean ANTIQUE) that might not display it (I've never used it).

This is what I see with a biggish sketch for a Nano (with old bootloader); please note the last line.

Sketch uses 14596 bytes (47%) of program storage space. Maximum is 30720 bytes.
Global variables use 1595 bytes (77%) of dynamic memory, leaving 453 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.