Code, only works with some servos?


hi, unfortunately have servo problem arduino, pretty have code turn servo 0 degrees if 1 int value ldr , turn 180 degrees if another. problem seems more specific servo though. code:
code: [select]

#include <servo.h>

int ldr_pin = a2;
servo myservo;

void setup() {
 serial.begin(9600);
 myservo.attach(3);

 pinmode(49, output);
 pinmode(53, output);
 digitalwrite(49, high);
 digitalwrite(53, high);

}

void loop()
{
 int ldrreading = analogread(ldr_pin);
 serial.println(ldrreading);

 if ( ldrreading < 800 )
 {
   myservo.write(180);
   delay(100);
 }
 else
 {
   myservo.write(100);
   delay(100);
 }

 //delay(1000);
}




the digital write high leds used control ldr, problem if use code 1 of servos works perfectly, if use on other 2 doesn't work @ all. sort of feed back, example servo not move against position doesn't move per code. i've tried servos using sweep code in examples part, , work fine , sweep perfectly. code works 1 servo , not other two.
i guess important things know servo work seems more expensive while other 2 cheap servos, have label saying 9g on it?
is there anyway can other 2 working well? tried adding 1 second delay @ end doesn't seem make of difference?

can
               you see
that                       when
             
write                    stuff
all      over                         the
        page, it


can    be              really

hard       to           read?


Arduino Forum > Using Arduino > Programming Questions > Code, only works with some servos?


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62