Hi all,
im working on some ir remote control code.
I have it working using "unsigned int" but im guessing il soon run out of SRAM so i wanted to store my "unsigned int" to PROGMEM instead.
Here's the original code:
#include <IRremote.h>
IRsend irsend;
unsigned int chDWN[100]
= {
4650,4450,550,450,600,400,600,400,600,450,550,1400,600,1400,600,450,550,450,600,400,600,1400,600,400,600,1400,600,1400,600,400,600,400,600,450,550,4450,600,400,600,450,550,450,600,400,600,400,600,1400,600,1400,600,400,600,450,550,450,600,1400,550,1450,550,1450,550,450,600,400,600,1400,600,1400,600,1400,550,450,600,400,600};
void setup()
{
Serial.begin(9600);
}
void loop() {
irsend.sendRaw(chDWN, 100, 12); // Channel down
delay(2000);
irsend.sendRaw(chDWN, 100, 12); // Channel down
delay(2000);
}
But when i try to use PROGMEM i fail...
#include <avr/pgmspace.h>
#include <IRremote.h>
IRsend irsend;
PROGMEM prog_uint16_t chUP[100]
= {
4650,4450,550,450,600,400,600,400,600,450,550,1400,600,1400,600,450,550,450,600,400,600,1400,600,400,600,1400,600,1400,600,400,600,400,600,450,550,4450,600,400,600,450,550,450,600,400,600,400,600,1400,600,1400,600,400,600,450,550,450,600,1400,550,1450,550,1450,550,450,600,400,600,1400,600,1400,600,1400,550,450,600,400,600};
void setup()
{
Serial.begin(9600);
}
void loop() {
unsigned int chupInt;
int k; // counter variable
chupInt = pgm_read_word_near(chUP+ k);
irsend.sendRaw(chupInt, 100, 12); // Channel down
delay(2000);
irsend.sendRaw(chupInt, 100, 12); // Channel down
delay(2000);
}
Can anyone see what im doing wrong?
These are the errors i get..
IRsendDemo.cpp: In function 'void loop()':
IRsendDemo:21: error: invalid conversion from 'unsigned int' to 'unsigned int*'
IRsendDemo:21: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
IRsendDemo:23: error: invalid conversion from 'unsigned int' to 'unsigned int*'
IRsendDemo:23: error: initializing argument 1 of 'void IRsend::sendRaw(unsigned int*, int, int)'
Thanks!