invalid conversion

Hai all,

Anyone can help me on this error?

I'm trying to implement PROGMEM to store and recall my data.

C:\Program Files\Arduino\libraries\IRremote/IRremote.h:267:9: error: initializing argument 1 of 'void IRsend::sendRaw(const unsigned int*, unsigned int, unsigned int)' [-fpermissive]

void sendRaw (const unsigned int buf[], unsigned int len, unsigned int hz) ;

^

exit status 1 invalid conversion from 'unsigned int' to 'const unsigned int*' [-fpermissive]

And your code is?

#include <IRremote.h>
#include <SoftwareSerial.h>
#include <avr/pgmspace.h>

const unsigned int power PROGMEM = {2600,850, 400,500, 350,550, 350,950, 450,850, 1350,850, 500,400, 450,450, 450,450, 450,450, 450,400, 500,400, 450,450, 900,850, 950,800, 950,450, 350,950, 450,450, 450,450, 850,900, 450,450, 900,450, 350,550, 350,950, 450,450, 450,450, 450,400, 900,450, 400,950, 450,400, 450,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // UNKNOWN E3327DF7
const unsigned int power1 PROGMEM= {2600,850, 450,450, 450,450, 400,900, 450,800, 1400,850, 450,450, 450,400, 500,400, 500,400, 450,450, 450,400, 500,400, 900,900, 850,900, 900,450, 450,850, 900,900, 850,900, 500,400, 900,450, 400,500, 400,900, 500,400, 450,450, 450,450, 850,450, 450,900, 450,400, 450,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // UNKNOWN 87765094
const unsigned int okPROGMEM = {2650,850, 350,500, 450,450, 450,900, 400,850, 1350,900, 450,400, 500,400, 450,450, 450,450, 450,400, 500,400, 450,450, 900,850, 900,900, 900,450, 400,900, 450,450, 450,400, 950,850, 450,450, 900,400, 450,450, 450,900, 450,400, 500,400, 450,450, 900,450, 350,950, 900,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // UNKNOWN D72E81D2
const unsigned int ok1PROGMEM = {2650,850, 350,500, 450,450, 450,900, 400,850, 1350,900, 450,400, 500,400, 450,450, 450,450, 450,400, 500,400, 450,450, 900,850, 900,900, 900,450, 400,900, 450,450, 450,400, 950,850, 450,450, 900,400, 450,450, 450,900, 450,400, 500,400, 450,450, 900,450, 350,950, 900,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // UNKNOWN 4CA5E6FD

unsigned int displayIntpower;
unsigned int displayIntpower1;
unsigned int displayIntok;
unsigned int displayIntok1;

int k; // counter variable

IRsend irsend;

SoftwareSerial mySerial(9,10); // RX, TX

char ch;
//int i=0;

void setup() {

mySerial.begin(9600);
// while (!mySerial);

for (k = 0; k < 100; k++)
{
displayIntpower = pgm_read_word_near(power + k);
Serial.println(displayIntpower);
displayIntpower1 = pgm_read_word_near(power1 + k);
Serial.println(displayIntpower1);
displayIntok = pgm_read_word_near(ok + k);
Serial.println(displayIntok);
displayIntok1 = pgm_read_word_near(ok1 + k);
Serial.println(displayIntok1);
}
Serial.println();
}

void loop() {

ch=mySerial.read();

switch(ch)
{

case ‘A’: //POWER
irsend.sendRaw(displayIntpower,100,38);
delay(45);
irsend.sendRaw(displayIntpower1,100,38);
delay(45);
break;

case ‘B’: //OK
irsend.sendRaw(displayIntok,100,38);
delay(45);
irsend.sendRaw(displayIntok1,100,38);
delay(45);
break;
}
}

Please reformat using the code tags...[code] .... [/code]

unsigned int displayIntpower;
...
...
    irsend.sendRaw(displayIntpower,100,38);

Clearer now?

[color=red]unsigned int[/color] displayIntpower;
void sendRaw(unsigned int buf[color=green][][/color], int len, int hz);

See the pb?

sorry what i miss? booth are unsigned int

The sendRaw first param is a pointer to a buffer holding a bunch of unsigned int (see the []) not an unsigned int

The sendRaw() function is not designed to work with PROGMEM, either.

PaulS: The sendRaw() function is not designed to work with PROGMEM, either.

That is, and should be, easily fixed.

OP showed he knows how to read in Program MemorydisplayIntpower = pgm_read_word_near(power + k);so modifying the library to have a suitable sendRaw is pretty simple indeed

AWOL: That is, and should be, easily fixed.

True, but if OP doesn't know, or do, that, the code won't work when he/she recognizes the difference between a scalar variable and an array, and puts all the arrays in PROGMEM.

J-M-L: OP showed he knows how to read in Program MemorydisplayIntpower = pgm_read_word_near(power + k);so modifying the library to have a suitable sendRaw is pretty simple indeed

True. Hopefully by adding another method, though, not by modifying sendRaw().

yep - just a different signature