Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Re: Servo Issues on: February 10, 2013, 07:54:15 pm
Thanks for all the help guys! Man you are fast.
I didn't realize there was a servo library, or that it needed 40hz. I simply guessed that it used the pwm signal.
Problem Solved!
2  Using Arduino / General Electronics / Servo Issues on: February 10, 2013, 07:14:56 pm
Hello,
I just bought an arduino, and am doing my first project.  It is very simple, it takes a digital input, and tells a servo to go to one of the extremes based on the input. The sensor is a npn photoswitch (allan bradly, I can give you way more details if necessary).  I used the internal pullup resistor to read it.  It requires 12v, and the servo I am using is a Hitec HS-311(rated for 6v).  I used 8 AAs to power the Arduino Uno R3 and photoswitch, and also fed a dc-to-dc downstepper to go from 12v to 6v. 
The problem:
Video http://youtu.be/A8jij6bPTLg
 
Troubleshooting:
I used a multimeter to make sure the servo is receiving 6v
I tested a known good servo to eleminate the servo as the problem. similar issues
I tried different pins on the arduino and breadboard. nothing changed.

The code:
int ServoPin = 10;
int SensorPin = 12;
int SensorVal;

void setup()
  {
    pinMode (SensorPin,INPUT);
    pinMode (ServoPin,OUTPUT);
    SensorVal = LOW;
  }
 
void loop()
  {
    digitalWrite(SensorPin, HIGH);          //pullup resistor
    SensorVal = digitalRead(SensorPin);     //gets sensor
    if(SensorVal==HIGH){
      analogWrite(ServoPin, 240);           //255 is max, 240 in case it wasn't reading the pulses at 255
    }
   
    else{
      analogWrite(ServoPin,2);              //0 is min, 2 is same reason as mentioned above
    }
 
 
  } 



I can get you details if you need more, unsure of what else you'd want.
Thanks for the help!
Pages: [1]