SRAM Not enought memory to store A/C RAW codes

Everything related to protocols and IR codes
Post Reply
dakinet
Posts: 1
Joined: Sat Jul 21, 2018 10:35 pm

SRAM Not enought memory to store A/C RAW codes

Post by dakinet »

BUILDING IR SENDER TO CONTROLL A/C VOX
--------------------------------------------------------------------

I build some project with arduino uno that need to store A/C remote codes and execute them on demand.
Something like IR sender. Hard thing is long A/C codes that is needing to be read raw and after that it need to transmit it raw.

It working perfectly when im using only two commands
unsigned ONCOLD16CAUTO[] ={};
unsigned OFF[] ={};
(power on, power off) but i need to store around 60 commands.

These IR commands use too many Sram and i dont know what to doo.
Any solution for me?

If im trying to use tree or four function i get this message:

Code: Select all

Sketch uses 4754 bytes (14%) of program storage space. Maximum is 32256 bytes.

Global variables use 2088 bytes (101%) of dynamic memory, leaving -40 bytes for local variables. Maximum is 2048 bytes.
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
Error compiling for board Arduino/Genuino Uno.
Here is Arduino Uno scetch:

Code: Select all

#include "IRremote.h"

IRsend irsend;

void setup()
{
  Serial.begin(9600);
  pinMode(7, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
}

int khz=38; //NB Change this default value as neccessary to the correct modulation frequency
// ON and 2O C° with 1 FAN heat
const unsigned ONCOLD16CAUTO[] ={8972,4480,560,1664,556,1664,556,540,556,540,560,536,560,540,556,1664,556,1664,560,1660,560,1660,560,1664,556,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,1664,556,1664,556,1664,556,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,1664,556,540,556,1664,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,1664,556,540,560,1660,560,536,560,540,556,540,556,540,560,540,556,1664,556,1664,556,1664,556,1664,556,540,560,1664,556,1664,556,1664,584}; 
const unsigned OFF[] ={8972,4480,560,1664,556,1664,556,540,556,540,560,536,560,540,556,1664,556,1664,560,1660,560,1660,560,1664,556,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,1664,556,1664,556,1664,556,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,1664,556,540,556,1664,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,1664,556,540,560,1660,560,536,560,540,556,540,556,540,560,540,556,1664,556,1664,556,1664,556,1664,556,540,560,1664,556,1664,556,1664,584};
const unsigned OFF1[] ={8972,4480,560,1664,556,1664,556,540,556,540,560,536,560,540,556,1664,556,1664,560,1660,560,1660,560,1664,556,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,1664,556,1664,556,1664,556,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,1664,556,540,556,1664,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,1664,556,540,560,1660,560,536,560,540,556,540,556,540,560,540,556,1664,556,1664,556,1664,556,1664,556,540,560,1664,556,1664,556,1664,584};
const unsigned OFF2[] ={8972,4480,560,1664,556,1664,556,540,556,540,560,536,560,540,556,1664,556,1664,560,1660,560,1660,560,1664,556,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,1664,556,1664,556,1664,556,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,1664,556,540,556,1664,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,1664,556,540,560,1660,560,536,560,540,556,540,556,540,560,540,556,1664,556,1664,556,1664,556,1664,556,540,560,1664,556,1664,556,1664,584};








// POWEROFFVOX={8972,4480,560,1664,556,1664,556,540,556,540,560,536,560,540,556,1664,556,1664,560,1660,560,1660,560,1664,556,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,1664,556,1664,556,1664,556,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,1664,556,540,556,1664,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,1664,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,536,560,540,556,540,560,536,560,540,556,540,556,540,560,540,556,1664,556,540,560,1660,560,536,560,540,556,540,556,540,560,540,556,1664,556,1664,556,1664,556,1664,556,540,560,1664,556,1664,556,1664,584};



int dugme1=0;  //ON
int dugme2=0;  //OFF
void loop() {
dugme1=digitalRead(7);
dugme2=digitalRead(6);

if (!dugme1){         //SEND COMMAND ON 16*C, AUTOFAN
  
digitalWrite(13,HIGH);  
irsend.sendRaw(ONCOLD16CAUTO, sizeof(ONCOLD16CAUTO)/sizeof(int), khz);
delay(1000);


irsend.sendRaw(OFF1, sizeof(OFF1)/sizeof(int),khz);
delay(10000);

irsend.sendRaw(OFF2, sizeof(OFF2)/sizeof(int),khz);
delay(10000);



}
else if (!dugme2){    //SEND COMMAND OFF 
  digitalWrite(13,HIGH);  
  irsend.sendRaw(OFF, sizeof(OFF)/sizeof(int), khz);
  delay(1000);
    }
else {
  digitalWrite(13,LOW);
  }
    
}
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: SRAM Not enought memory to store A/C RAW codes

Post by AnalysIR »

Yes, it is very easy to run out of SRAM when sending long AC signals on a standard arduino.

A search thru our blog will return several solutions to solve this issue for you......
e.g. https://www.analysir.com/blog/2016/04/1 ... -irremote/

https://www.analysir.com/blog/tag/air-conditioner/
Post Reply