Hi all,
I've googled this but other issues I see are all related to converting int to char. I'm just assigning integers to unsigned int.
This is an example code replicating the issue:
unsigned int rawCodes[3] = {0, 1, -1};
Any negative values drop this error:
- warning: narrowing conversion of '-1' from 'int' to 'unsigned int' inside { } [-Wnarrowing]
This is for an IR sender project I'm doing just to have a play. I read the raw valued using a reader which gives me many positive and negative values, then I send it using the IRRemote Library.
What am I missing or should change?
Here's the full code:
#include <IRremote.h>
IRsend irsend;
unsigned int rawCodes[439] = {3528, -1696, 440, -428, 440, -1292, 468, -400, 440, -424, 440, -428, 468, -400, 440, -424, 412, -456, 440, -424, 468, -400, 464, -428, 440, -428, 440, -424, 440, -1292, 468, -400, 436, -428, 444, -424, 444, -424, 440, -424, 440, -428, 440, -424, 444, -1288, 412, -1320, 440, -1296, 468, -396, 468, -428, 436, -1296, 436, -428, 440, -428, 440, -424, 440, -428, 440, -428, 436, -428, 412, -456, 440, -424, 440, -428, 440, -424, 440, -428, 436, -432, 436, -428, 440, -452, 444, -424, 436, -428, 440, -428, 440, -424, 416, -452, 440, -428, 440, -424, 440, -428, 440, -424, 440, -428, 440, -428, 436, -428, 444, -424, 468, -424, 440, -424, 444, -424, 444, -1288, 468, -1264, 440, -428, 436, -432, 440, -424, 444, -424, 436, -428, 412, -10008, 3528, -1700, 440, -424, 444, -1292, 464, -428, 440, -428, 436, -428, 440, -424, 440, -428, 444, -424, 436, -428, 444, -424, 440, -424, 468, -400, 440, -424, 444, -1292, 436, -428, 440, -428, 468, -424, 440, -428, 468, -396, 444, -424, 468, -396, 444, -1288, 440, -1296, 436, -1292, 472, -396, 472, -396, 440, -1292, 440, -424, 444, -424, 440, -428, 436, -428, 444, -424, 464, -428, 440, -428, 440, -424, 440, -428, 440, -424, 472, -396, 440, -424, 440, -428, 440, -1292, 468, -1264, 440, -1292, 440, -1292, 472, -396, 440, -428, 440, -1292, 496, -396, 468, -400, 440, -424, 440, -1292, 440, -1296, 436, -1296, 440, -1292, 440, -424, 444, -424, 440, -424, 444, -424, 440, -428, 440, -424, 440, -428, 440, -424, 440, -428, 468, -1292, 468, -1264, 436, -428, 440, -1296, 440, -424, 440, -1292, 440, -1292, 468, -1264, 444, -424, 468, -1264, 440, -428, 436, -428, 468, -1264, 444, -424, 440, -428, 440, -424, 468, -424, 444, -424, 440, -428, 436, -428, 468, -400, 440, -424, 468, -400, 440, -424, 452, -416, 440, -428, 440, -1292, 440, -1292, 464, -1268, 440, -424, 440, -428, 468, -424, 440, -428, 440, -428, 440, -424, 440, -428, 440, -424, 440, -428, 440, -1292, 468, -1264, 440, -1292, 468, -396, 444, -424, 440, -428, 440, -424, 440, -428, 440, -452, 440, -428, 440, -424, 440, -428, 440, -424, 444, -424, 440, -428, 468, -396, 444, -424, 440, -424, 444, -424, 440, -1292, 440, -428, 440, -424, 468, -1264, 468, -428, 440, -424, 444, -420, 444, -1292, 440, -424, 468, -400, 440, -424, 444, -424, 440, -428, 440, -424, 444, -424, 468, -396, 444, -424, 440, -424, 468, -428, 468, -396, 444, -424, 440, -424, 468, -400, 444, -420, 472, -396, 468, -1264, 440, -1292, 440, -428, 468, -400, 440, -424, 468, -396, 464, -404, 472};
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
irsend.sendRaw(rawCodes, 439, 38);
Serial.println("Sent the code");
delay(10000);
}
Thanks