I'm a dairy farmer and I'm new to playing around with Arduino's. I created a code to send me SMS's when my equipment stops working as it should, but I run into a "Not enough memory" error. Here's my code:
#include <OneSheeld.h>
int IPFeed = 13;
int IPScraper = 12;
int IPPump = 11;
int XVal = 0;
int TFeedCharge = 0;
int TFeedRun = 0;
int TScraper = 0;
int TPump = 0;
int TLFeedCharge = 60;
int TLFeedRun = 60;
int TLManure = 2;
int TInc = 60000;
void setup() {
pinMode(IPFeed, INPUT);
pinMode(IPScraper, INPUT);
pinMode(IPPump, INPUT);
OneSheeld.begin();
}
void loop() {
XVal = digitalRead(IPFeed);
if (XVal == HIGH) {
TFeedRun = 0;
TFeedCharge = TFeedCharge +1;
if (TFeedCharge == TLFeedCharge) {
delay(150);
SMS.send("613xxxxxx6","ProFeed 2020 is stoped at the charging station.");
delay(150);
SMS.send("613xxxxxx9","ProFeed 2020 is stoped at the charging station.");
TFeedCharge = 0;
}
}
else {
TFeedCharge = 0;
TFeedRun = TFeedRun +1;
if (TFeedRun == TLFeedRun) {
delay(150);
SMS.send("613xxxxxx6","ProFeed 2020 is stopped away from the charging station.");
delay(150);
SMS.send("613xxxxxx9","ProFeed 2020 is stopped away from the charging station.");
TFeedRun = 0;
}
}
XVal = digitalRead(IPScraper);
if (XVal == HIGH) {
TScraper = TScraper +1;
if (TScraper == TLManure) {
delay(150);
SMS.send("613xxxxxx6","The manure scraper has stopped working.");
delay(150);
SMS.send("613xxxxxx9","The manure scraper has stopped working.");
TScraper = 0;
}
}
XVal = digitalRead(IPPump);
if (XVal == HIGH) {
TPump = TPump +1;
if (TPump == TLManure) {
delay(150);
SMS.send("613xxxxxx6","The manure pump has stopped working.");
delay(150);
SMS.send("613xxxxxx9","The manure pump has stopped working.");
TPump = 0;
}
}
delay(TInc);
}
Here is the error message:
Arduino: 1.8.19 (Windows 10), Board: "Arduino Nano, ATmega328P"
Sketch uses 24812 bytes (80%) of program storage space. Maximum is 30720 bytes.
Global variables use 2087 bytes (101%) of dynamic memory, leaving -39 bytes for local variables. Maximum is 2048 bytes.
Not enough memory; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing your footprint.
data section exceeds available space in board
Error compiling for board Arduino Nano.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any ideas on how to fix this issue?