servo's not working

Hello,

so i am working on a project. when i was coding and testing i used a servo and it all worked fine.
when i recieved the servo’s for the project the servo’s don’t move at all. the servo’s do work when i load the standard sweep sketch but for some reason it does not work with my sketch.

i’m powering the servo’s externaly and the servo’s and motors are connected to the same pins as in the code.

can anybody help me? i’ve been trying to figure it out all day but got no where

i’m thankfull for any help i can get.

-dutch

tracer_gun_V2.ino (897 Bytes)

If the servos do nothing at all how sure are you that the buttons work? From the code, you seem to have them wired the opposite way round to normal. How are they connected? Try adding some Serial prints to see if it ever gets into the servo moving part of the code.

Or try putting just the servo moves into setup() and check that they at least move once. If not, your wiring is probably wrong somewhere.

Steve

Do you have pulldown (10k) resistors from button pins to GND? Have you tried any positions besides 0 and 180? Do you have the proper voltage on the servo power wires?
Test each servo on pin 9 with this test sketch:

/*
 Try this test sketch with the Servo library to see how your
 servo responds to different settings, type a position
 (0 to 180) or if you type a number greater than 200 it will be
 interpreted as microseconds(544 to 2400), in the top of serial
 monitor and hit [ENTER], start at 90 (or 1472) and work your
 way toward zero (544) 5 degrees (or 50 micros) at a time, then
 toward 180 (2400). 
*/
#include <Servo.h>
Servo servo;

void setup() {
  // initialize serial:
  Serial.begin(9600); //set serial monitor baud rate to match
  servo.write(90);
  servo.attach(9);
  prntIt();
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int pos = Serial.parseInt();
    pos = constrain(pos, 0, 2400);
    servo.write(pos);
    prntIt();
  }
}
void prntIt()
{
  Serial.print("  degrees = "); 
  Serial.print(servo.read());
  Serial.print("\t");
  Serial.print("microseconds =  ");
  Serial.println(servo.readMicroseconds());
}