One way to do it is to connect your IR-diode between pin 3 and pin 0 (with a resitor in serie)
That way the diode is on only when pin 3 is LOW.
Don't expect too much precision, partly bescause you don't use a x-tal (asumption) and partly because there are some overhead in the loop.
BTW the code asumes the Attiny85 is running @ 8 MHZ.
/*
Anode (long leg connected) to 0
Cathode (short leg to 3 through resistor)
*/
void setup(){
TCNT0 = 0;
TCCR0A=0;
TCCR0B=0;
TCCR0A |=(1<<COM0A0); //Timer0 in toggle mode Table 11.2
TCCR0A |=(1<<WGM01); //Start timer 0 in CTC mode Table 11.5
TCCR0B |= (1 << CS00);// Prescaler Table 11.6
OCR0A=105; //CTC Compare value
pinMode(0,OUTPUT);
pinMode(3,OUTPUT);
}
void loop(){
PORTB |=_BV(3); //off
delayMicroseconds(500);
PORTB &=~_BV(3); //on
delayMicroseconds(400);
}
Pin 0 is the reset pin , I connected through a receiver , but no data is being generated.
I am using ardunio with an IR Receiver (ISOP1738) to decode the IR data that is being sent by Attiny85. With this code changes I am not seeing any data coming to the IRReceiver.
and if I obstruct the IR led with my hand or say paper some data is being generated. Looks like the IR led is sending the 38khz wave constantly and when I obstruct with my hand I could see some data.