Setting a MCU IC to 38 Khz and controlling the pulse...For IR Emitter

Need help with the code and initializing a microchip. Looking to use a MCU IC ATTiny414 to modulate an IR led signal at 38Khz, pulsed at 600us on and 900us off.

Is this the general Idea?

  1. Init the chip/timer of to 38Khz
  2. Set the output pin High at that frequency
  3. delay for 600us
  4. Set the pin Low
  5. delay for 900us

Can’t find any exact matches as suggestions to code this. So I’m trying to piece together solutions from here and others. Need help adapting the set up (that code is for an Uno I believe. I HAVE to use a ATtiny412 for this project.

556-ATTINY412-SSNR - 8-bit Microcontrollers - MCU 105C, 5.5V, Green, 20MHz, SOIC8, T&R
Mouser Datasheet: mouser.com/datasheet/2/268/40001911A-1220759.pdf

What I have so far…IF this is the right approach:

const byte IRLED = 2;  // Timer 2 "A" output: OC2A 

void setup() {
 pinMode (IRLED, OUTPUT);

// set up Timer  for 38khz  - *NEED* BIG HELP understanding how to adapt this code for Arduino //(N.Gammon) to  a ATtiny414 MCU IC

 TCCR2A = _BV (COM2A0) | _BV(WGM21);  // CTC, toggle OC2A on Compare Match
 TCCR2B = _BV (CS20);   // No prescaler
 OCR2A =  209;          // compare A register value (210 * clock speed)
                       		 //  = 13.125 nS , so frequency is 1 / (2 * 13.125) = 38095
}  // end of setup

void loop() { 
	//the IR receiver is expecting “on” 600us and “off” 900us
    digitalWrite(IRLED, HIGH);   //turn on the IR LED
	delayMicroseconds(900);          
    digitalWrite(IRLED, LOW);    //turn off the IR LED
   	delayMicroseconds(600);         

} //end of loop

Should go without saying that I am an artist not an engineer, so please help with that in mind.

There is a library how does that stuff. Search for >IRRemote library<
And its not about the IC clock frequency. The frequency is set by the on/off time.
But only set the frequency is not enough. To send any data you will need to modulate it. That library can do it for you.