Please see if this sketch will correctly send the "1" key to your cable box. It doesn't require any libraries. And it sends at 36KHz, although you can change it back to 38 if you want. If this works, then it should work on any protocol if the raw transmission has been captured. But I still need to get it to work sourcing the data from flash. There's only 2K bytes of ram.
You might also test to see if it still works with the repeat deleted.
/*
* TechnicsTestRawSend.ino
* This sends the "1" key to SA cable box.
* For Uno, Nano, Pro Mini - use D10 to trigger the IR LED
* No libraries needed
* Still need to source data from flash, not ram
* Sends automatically on boot. Hit reset to send again.
*/
const byte LED = 10; // Timer 1 "B" output: OC1B
volatile unsigned int Count;
volatile unsigned int newCount;
volatile unsigned int j;
unsigned int oldj;
byte oldTIMSK0;
unsigned int countDiv;
unsigned int One[] = {
3349, 3348, 841, 2529, 841, 2529, 840, 840,
839, 2529, 841, 2529, 841, 839, 840, 839,
841, 839, 839, 839, 841, 2530, 840, 839,
840, 839, 840, 839, 840, 2530, 840, 839,
840, 839, 840, 2530, 840, 2530, 840, 2531,
839, 2530, 854, 825, 840, 2530, 839, 37463,
3350, 3349, 840, 2530, 840, 2531, 839, 838,
841, 2530, 839, 2531, 840, 838, 840, 839,
841, 839, 864, 815, 840, 2531, 838, 841,
839, 840, 840, 839, 839, 2530, 840, 839,
840, 840, 839, 2531, 839, 2531, 840, 2530,
839, 2531, 839, 840, 839, 2530, 840};
void setup() {
pinMode (LED, OUTPUT); digitalWrite(LED,LOW);
pinMode (13, OUTPUT); digitalWrite(13,LOW);
TCCR1A = bit (WGM10) | bit (WGM11); // fast PWM, normal port
TCCR1B = bit (WGM12) | bit (WGM13); // fast PWM, timer stopped
TIMSK1 = bit (OCIE1B); // enable interrupt - each cycle
TCNT1 = 300; // timer count near top
}
void loop() {
sendTechnics(One, sizeof(One) / sizeof(One[0]), 36);
while(1);
}
void sendTechnics(const unsigned int buf[], unsigned int len, unsigned int hz) {
oldTIMSK0 = TIMSK0; // disable millis interrupt
TIMSK0 = 0;
digitalWrite(13, HIGH); // indicator LED on
j = 0;
oldj = 0;
countDiv = (1000 + hz/2)/hz; // divide input by this to get cycles
Count = (buf[0] + countDiv/2)/ countDiv;
newCount = (buf[1] + countDiv/2) / countDiv;
OCR1A = (((F_CPU/1000) +hz/2) / hz) - 1; // zero relative
OCR1B = OCR1A /3; // 33% duty cycle
TIMSK1 = bit (OCIE1B); // enable interrupt - each cycle
TCCR1A ^= bit (COM1B1); // clear on B match
TCCR1B ^= bit (CS10); // fast PWM, no prescaler, timer on
while (j < len) {
while (oldj == j);
if (j < (len - 1)) newCount = (buf[j+1] + countDiv/2) / countDiv;
oldj = j;
}
TCCR1B &=0xFE; // stop clock
TCCR1A &=0xDF; // disconnect output
TIMSK0 = oldTIMSK0; // enable millis
digitalWrite(13, LOW); // indicator LED off
}
ISR(TIMER1_COMPB_vect) {
Count--;
if (Count == 0) {
TCCR1A ^= 0x20; // Connect or disconnect D10 to Timer1 output
j++;
Count = newCount; // get next value
}
}