8 kHz power signal with Uno

What is easiest way to create a 8 kHz output signal with Arduino Uno ? Best way i can think is just counting micros by keeping 62 micros on and another 62 micros off :roll_eyes:

Any other ideas?

Meaning is drive with LM298 some 9-12VDC to perimeter wire ending to current limiting resistor.

Timer1.

http://playground.arduino.cc/code/timer1

Maybe try:

Thank you guys. Of course the tone command is just meant for that :roll_eyes:

This code sets up pins 9 and 10 (timer1 on the Uno), in antiphase at 8kHz.
You have to read section 15 of the ATmega328P datasheet to see how the
register values control timer1 in detail

void setup ()
{
  pinMode (9, OUTPUT) ;
  pinMode (10, OUTPUT) ;
  TCCR1A = 0xE2 ;  // Set up mode 14, fast PWM with TOP=ICR1
  TCCR1B = 0x19 ;   // prescale is divide-by-1, so 2000 cycles = 125us
  ICR1  = 2000-1 ;    // counts from 0..1999 continuously
  OCR1A = 1000-1 ;  // set PWM outputs at midpoints
  OCR1B = 1000-1 ;
  TCNT1 = 0x0000 ;  // counter set to zero
}

void loop ()
{}