myservo.detach() not releasing PWM on Digital pins 9 & 10


according servo.detach() - reference  use of command should release pwm feature of pins 9 & 10.  however, not.

i have been googling issue hour , found many references on years, no apparent resolution... lot of advice to  "use different pins".

update: yes, technically dreaded "workaround", able cobble simple servo control method works , without need of library.  posted further on in topic, here don't wish read fluff.
code: [select]

// manual servo control
// smooth , minimal jitters - no library needed.
//
// using potentiometer, fed number from
// 0-1023 gets mapped microsecond pulses servo.
// servo worked best 690-2350 (0.69ms - 2.35ms) 180 deg range.
// adjust accordingly fit servo.
//
// gunner.

#define servo_pin 5
#define pot_pin a2
int servopos;

void setup()
{
  pinmode(servo_pin, output);
}

void potturn()
{
  servopos = map(analogread(pot_pin), 0, 1023, 2350, 690);  // map microsecond pulse (i.e. 2.35*1000=2350)
  digitalwrite(servo_pin, high);  // activate servo pin, send servo 0.
  delaymicroseconds(servopos);  // delay length of pulse.
  digitalwrite(servo_pin, low);  // deactivate servo pin.
  delay(5);  // little delay seemed necessary stabilize everything.
}

void loop()
{
  potturn();
}



now project, using uno r3 diyode codeshield.  shield has fixed pin arrangement,  , rgb led utilizes pins 11, 10 & 9 respectively.  other pwm pins utilized (including single servo), , running of other devices anyhow, switching pins not option in case.  rgb work fine until call servo action attach(x) command, loose pwm control on green , blue part of rgb... , doesn't same without them :)

so question is;  after these years , updates, had issue been looked into?  if so, resolution?  if not... couldn't @ least change reference info ;)

the shield has fixed pin arrangement
that's why hate use of shields

presumably servo.detach()'ed all servos?

i must had never read part says servo.detach() gives pin 9 , 10 pwm back, (to me anyway) conflicts main servo page, says...

quote
on boards other mega, use of library disables analogwrite() (pwm) functionality on pins 9 , 10
i took mean mere presence of line...

code: [select]

#include <servo.h>


... meant using library, took away pwm pins 9 , 10.




Arduino Forum > Development > Other Software Development > myservo.detach() not releasing PWM on Digital pins 9 & 10


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor