servo

how disable PWM on pins 11 and 12 ? how disables analogWrite() (PWM) functionality on pins 9 and 10 ?

I have no idea, but have to ask, "why?"

What's that got to do with the subject "servo"?

Is this an XY problem?

i want to control 18 servo with arduino mega .. so i must disable pins 11 and 12 as shown here

https://www.arduino.cc/en/Reference/Servo

I don't think that's what it says... that reads to me that if you use more servos you will lose PWM functionality on some pins. I don't think it says that you have to disable that PWM functionality to enable the use of more servos.

ik that jim .. but i wanna make sure if i understand it correctly .. meanly if wanna control 23 servo dont attach it on pins 11.12

Yahia_Elsaeed: ik that jim .. but i wanna make sure if i understand it correctly .. meanly if wanna control 23 servo dont attach it on pins 11.12

It says you can't use analog write (PWM) pins 11 and 12 (which is not the servo control format), It does not say that you cannot use the pins for servo control. Probably easiest to try the pins and see what happens.

The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12.

zoomkat: It says you can't use analog write (PWM) pins 11 and 12 (which is not the servo control format), It does not say that you cannot use the pins for servo control. Probably easiest to try the pins and see what happens.

Ah well spotted zk: perhaps OP is thinking servo control is PWM and so not available on those pins?

As you say, test it and see.

as i said u cant use this pin as pwm ... when increase the no of servo u will disable some of pins " as shown on servo "

So, tell us again - what’s the problem, or are you just making a statement?

Pwm pin at mega is pin 2 untill 13 only , 12 pwm pins How it can 18 servos?

The servo library makes its own PWM