pwm 10 khz sinyal oluşturma

merhaba arkadaşlar ben pwm ile 10 khz sinyal oluşturdum fakat sinyal 1 ve 0 arasında garip bir şekilde gidip geliyor. ben 10 khz süresince yani 100us de 1 kez 1 ve 0'a gitmesini istiyorum. kodlar burda bunu değiştirip bana gönderirseniz çok sevinirim.

#include <PWM.h>

//use pin 11 on the Mega instead, otherwise there is a frequency cap at 31 Hz
int led = 7; // the pin that the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
int32_t frequency = 20000; //frequency (in Hz)

void setup()
{
//initialize all timers except for 0, to save time keeping functions
InitTimersSafe();

//sets the frequency for the specified pin
bool success = SetPinFrequencySafe(led, frequency);

//if the pin frequency was set successfully, pin 13 turn on
if(success) {
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
}
}

void loop()
{
//use this functions instead of analogWrite on 'initialized' pins
pwmWrite(led, brightness);

brightness = brightness + fadeAmount;

if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}

delay(30);
}

hello friends I created a 10 khz signal with pwm, but the signal is oddly switching between 1 and 0. I want it to go to 1 and 0 times at 100us so during 10 khz. I would appreciate it if you change the code here and send it to me.

(Google translate)

If you want a square wave at 50% 50% I would suggest changing your clock to 20Khz and using a type D flop connect the D input to the output and the clock to the clock input, the output will be 1/2 the input frequency, nice and symmetrical. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil