Im trying to blink my IR LED through the IRremote library's irSendRaw function but upon running the code the mkr just hangs up, it cant even serial print in the setup.
#include <IRremote.h>
IRsend irsend;
int khz = 38; // 38kHz carrier frequency for the NEC protocol
unsigned int irSignal1[] = {9028, 4478, 664, 1644, 662, 544, 662, 544, 662, 1646, 663, 543, 663, 1645, 662, 544, 662, 544, 662, 1646, 663, 1645, 662, 543, 663, 544, 663, 543, 662, 544, 663, 544, 662, 545, 662, 544, 662, 544, 663, 544, 661, 544, 663, 544, 662, 1646, 663, 1645, 663, 543, 664, 543, 663, 543, 663, 544, 663, 543, 662, 1646, 662, 544, 663, 1645, 663, 543, 663, 544, 662, 1646, 662, 543, 663, 19976, 663, 544, 663, 543, 664, 544, 663, 543, 669, 537, 662, 544, 662, 544, 662, 544, 663, 543, 663, 544, 662, 544, 663, 543, 664, 542, 664, 1644, 663, 543, 663, 544, 663, 543, 663, 543, 662, 543, 664, 542, 664, 543, 663, 543, 663, 544, 662, 544, 663, 543, 663, 543, 663, 543, 663, 543, 663, 543, 663, 543, 664, 543, 663, 1644, 663};
unsigned int irSignal2[] = {9030, 4478, 658, 1651, 658, 527, 680, 550, 657, 549, 658, 548, 659, 1649, 659, 527, 680, 549, 657, 1650, 658, 1649, 634, 574, 657, 549, 658, 549, 633, 573, 633, 572, 635, 572, 634, 573, 633, 574, 657, 551, 630, 577, 630, 576, 631, 1677, 632, 575, 632, 575, 631, 576, 631, 575, 632, 574, 633, 574, 633, 1675, 633, 575, 631, 1678, 631, 573, 634, 576, 631, 1676, 633, 575, 632, 20012, 635, 574, 638, 570, 631, 576, 631, 575, 632, 574, 632, 574, 633, 575, 632, 575, 632, 575, 632, 574, 634, 572, 634, 573, 634, 573, 633, 1675, 633, 575, 631, 575, 633, 572, 634, 572, 635, 573, 633, 574, 633, 575, 631, 575, 633, 574, 633, 573, 634, 574, 634, 574, 631, 577, 630, 576, 631, 575, 631, 576, 632, 575, 631, 575, 632};
void setup()
{
Serial.begin(115200);
Serial.println("Running Program");
}
void loop() {
Serial.println("Starting");
Serial.println("Turning Aircon ON");
irsend.sendRaw(irSignal1, sizeof(irSignal1) / sizeof(irSignal1[0]), khz); //Note the approach used to automatically calculate the size of the array.
delay(3000);
Serial.println("Turning Aircon OFF");
irsend.sendRaw(irSignal2, sizeof(irSignal2) / sizeof(irSignal2[0]), khz); //Note the approach used to automatically calculate the size of the array.
Serial.println("Ending");
delay(3000);
}
The code above does not work nothing show up on serial monitor even the "Running program" inside setup. BUT if i comment out irsend.sendRaw() everything works fine all the serial prints show up.
I conclude that the sendRaw() function is the one messing up,
I even disconnected PIN 12, where the irLED should be connnected on the MKR1000, and it still doesnt work. anyone know why?