pwm on pin 13 uno

hi
i have started arduino recently . and i want make pwm on pin 13 !
but not by software .
is there any solution ?
sry for my English
best regards

13 isn't on a harware timer. If you want PWM on that pin you must do it with software. Or pick a different pin that is hardware PWM able.

i want make pwm on pin 13 !
but not by software

What Arduino model?

I think you can get hardware timer output on pin 13 on the Due, Zero, and Mega.

EDIT:
Never mind :wink:
Forgot to read thread title. Thanks Delta G, I was half asleep.

cattledog:
What Arduino model?

Read the thread title.

i mean arduino uno .
i can not change pin !and by software it will cause problem for other code .

https://forum.arduino.cc/index.php?topic=421259.0

there is some solution but i couldnt find the file

The thread you linked copied the url for is about an Arduino Zero. I thought you said you have an UNO.

payam2000:
i can not change pin !and by software it will cause problem for other code .

What problems for what other code? Depending on what the other code does there may be options.

i need 3 to 4 volts all time and i want to read sensor by adc ! so i should have pwm hardware

OK. You want to answer the question I asked in my post? Or are you ignoring me?

Does the voltage you need have to vary? Or will it be the same voltage all the time?

PWM won't give you a stable voltage. It would give you 0V part of the time and 5V part of the time.

no im not ignoring you .
the voltage is same during main loop . but it could be change some where in menu

sry for my english :confused:

What about the other question. What problems do you think doing this in software would cause for your code? What does your code do? If you'll show us the code we may be able to come up with options for you. But short of that it sounds like you just need to pick a different pin.

i need 3 to 4 volts all time

For what purpose?

i want to read sensor by adc !

What sensor? How do you want to read the sensor?

so i should have pwm hardware

This statement does not follow from either of the first two?

Do you want the 3-4 volts at an analog level? If so, maybe you want to put the pulses through a low pass filter to achieve an analog output.

I'm still not understanding why your pulses need to be generated by hardware and not software. Can you explain the problem you are trying to solve?

OP, here is a link you should investigate. Then you can come back here and add some needed information.

Hi,
Are you using ALL the PWM pins for PWM output?

If you need extra digital pins to free the PWM pins, you can use the analog pins as digital pins.

What is your application?

Thanks ..... Tom... :slight_smile:

I tried using the fading example. Originally it is using pin 9 as output and the fading of the led is working. I noticed that upon changing the pin value to 13 and transfering the physical wire to output pin 13, the led just blinks. No fading happened on pin 13. I recon this is a hardware configuration. Please correct me if I am wrong.

I'm using Geekcreit® UNOR3

I noticed that upon changing the pin value to 13 and transfering the physical wire to output pin 13, the led just blinks. No fading happened on pin 13.

Pin 13 is not a PWM output pin on the UNO. It is not an output pin for any of the hardware timers on the UNO.

romelmel20:
I tried using the fading example. Originally it is using pin 9 as output and the fading of the led is working. I noticed that upon changing the pin value to 13 and transfering the physical wire to output pin 13, the led just blinks. No fading happened on pin 13. I recon this is a hardware configuration. Please correct me if I am wrong.

I'm using Geekcreit® UNOR3

Why do you have to change or fo pin 13 then? The more you tell the easier it becomes for all of us.