Trouble with PWM pins
hello , thank in advance may give.
bellow mycode. problem myservo.attach(10) causes 1 of 2 motors not turn. long don't include in code have no problems either motor. can't pwm function on pins 3, 5, , 6 work; not motors or servos. doing wrong?
bellow mycode. problem myservo.attach(10) causes 1 of 2 motors not turn. long don't include in code have no problems either motor. can't pwm function on pins 3, 5, , 6 work; not motors or servos. doing wrong?
code: [select]
#include <servo.h>
int lmotord_pin = 8;
int rmotord_pin = 12;
int rmotorpwm_pin = 9;
int lmotorpwm_pin = 11;
servo myservo;
void setup()
{
pinmode(lmotord_pin, output);
pinmode(rmotord_pin, output);
myservo.attach(10);
myservo.write(5);
delay(2000);
}
void loop()
{
digitalwrite(rmotord_pin, high);
digitalwrite(lmotord_pin, high);
analogwrite(lmotorpwm_pin, 100);
analogwrite(rmotorpwm_pin, 100);
}
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Trouble with PWM pins
arduino

Comments
Post a Comment