Pro Trinket

So I'm having trouble with my sketch being too large. I have just about everything I need in it but I'm about 12% over the total capacity for the sketch. Can you guys help me with down sizing it? All help would be very much appreciated. I'm in kind of a time crunch with finishing this. I would post my whole code but I'm exceeding the maximum character allowance.

Reply & use the Attach feature at the bottom. Can't reduce what can't be seen.

Much appreciated.

THE_SMART_BAND.ino (9.13 KB)

Are you over on RAM usage or code size?

If you’re over on code size then you might need a chip with more memory. Your sketch is pretty short but uses some big libraries. There’s not a lot to cut there.

If you’re over on RAM then that’s easier to fix. The first step would be to get the constant strings out of RAM with the F macro.

Just some info on the project. I have a arduino Pro trinket, needing to use a GPS, temperature sensor, and pedometer (accelerometer). I wanted to include a heart rate sensor (amped pulse sensor), but the interrupt for the pulse sensor was conflicting with the GPS so I removed it from the code (hence the blank case 2 statement). If at all possible I would like to include the pulse sensor if you guys know a fix. I removed all the comments from the code to try to save even the smallest amount of space so ill upload another sketch with he comments if it will help with understanding whats going on though the commented code does not have the SD library I need to store the pedometer and longitude and latitude from the gps. Once again, thanks for the help. Any questions you have feel free to ask.

THE_SMART_BAND.ino (16.4 KB)

I just tried the F macro on a few of my print statements where I am printing to the lcd, and it brought me down to 111%. I have found my two biggest memory problems in the code which is the File and String variables at the bottom of this posted code which account for about 9 to 10% of the memory.

int threshhold = 0;
int avgmax = 0;
int avgmin = 0;
int totave = 0;
int totaveold = 0;
int totavemax = 0;
int totavemin = 0;
int smallthresh = 0;
int xaccl = 0;
int yaccl = 0;
int zaccl = 0;
int steps,flag,flag2=0;
int count = 0;

// Temperature Sensor Variable
int f = 0;
File myFile;
String dataString = "";