Go Down

Topic: How i make delay .5 microseconds? (Read 1 time) previous topic - next topic

power7net

Finaly 95 KHz is wrong i think i want a bandwidth 30-56KHz ....possible frequencies....
Web / sms / bluetooth / arduino / android remote control. Home Automation projects.
http://www.power7.net

power7net

Code: [Select]

void pulseIR(long microsecs) {
  // we'll count down from the number of microseconds we are told to wait

  cli();  // this turns off any background interrupts

  while (microsecs > 0) {
    // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IR_PIN4, HIGH);  // this takes about 3 microseconds to happen
   delayMicroseconds(10);         // hang out for 10 microseconds
   digitalWrite(IR_PIN4, LOW);   // this also takes about 3 microseconds
   delayMicroseconds(10);         // hang out for 10 microseconds

   // so 26 microseconds altogether
   microsecs -= 26;
  }

  sei();  // this turns them back on
}

void SendACCodeOn() {
  // This is the code for my particular Toyotomi on button

  pulseIR(9000);
   delayMicroseconds(4340);
  pulseIR(840);
   delayMicroseconds(320);
  pulseIR(740);
   delayMicroseconds(400);
  pulseIR(700);
   delayMicroseconds(1440);
  pulseIR(740);
  ........

}
Web / sms / bluetooth / arduino / android remote control. Home Automation projects.
http://www.power7.net

Go Up