I have a code that is functional but with low memory warning on a UNO :
Global variables use 1636 bytes (79%) of dynamic memory, leaving 412 bytes for local variables. Maximum is 2048 bytes. Low memory available, stability problems may occur.
These are libraries I use :
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <phi_interfaces.h>
#include <Wire.h>
#include <SdFat.h>
#include "RunningAverage.h"
And these are the global variables :
byte prevSecond, second, minute, hour, dayOfWeek, dayOfMonth, month, year;
char clockStringNow[17];
char tempchar[5];
char Yr_Array[5];
char Mo_Array[5];
char Dt_Array[5];
char Hr_Array[5];
char Mi_Array[5];
char CurLoc, NCurLoc;
boolean RTC_Set_Gate, RTC_Set_Gate01 = 1, RTC_Set_Gate02 = 0, homeDispGate = 1, setClockBit ;
boolean beginLogGate = 1, fileChooseGate, newFileGate, oldFileGate, dumpDataGate ;
boolean eraseConfGate, doLoggingGate, logSwitchGate, waitOnSerGate, sendDataGate;
const byte logOnSw = 5;
const byte scan_LED = 6;
const byte logging_LED = 7;
const byte lowBatt_LED = 8;
const byte SDCselect = 10;
const byte cardDetect = 9;
const int lm35Pin = 0; // Analog pin to use.
char LCDmsg[17];
char dataToLog[20];
unsigned long scanMs = millis();
unsigned int loopInterval = 100;
unsigned long logMs = millis();
unsigned int loggingInterval = 5; // Enter the interval in second
int setClockCount ;
char validDIN = '0';
char userRequest;
int RA_SampleSize = 20;
long Val_00 = 0; // Variable to hold raw AI data
float analog_Ch0Val, tempDegC;
int battVolts ;
char tem;
char buffer[10];
I have made sure to store all lcd messages in Flash area with the lcd.print(F());
Though the code is executing ( its a single channel datalogger that writes to the SD card once every five seconds one channel value) I have a problem with a boolean variable " dumpDataGate " that seems to be loaded with a value like 52, 53, 56, 57 54 when i check with Serial.print(dumpDataGate);
How it this ( boolean holding a value other than 0 or 1 ) possible and can low memory lead to these kind of issues ?
( I can post the whole code but it will exceed the forum limit)