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;
SensorVal = LOW;
digitalWrite(SensorPin, HIGH); //pullup resistor
SensorVal = digitalRead(SensorPin); //gets sensor
analogWrite(ServoPin, 240); //255 is max, 240 in case it wasn't reading the pulses at 255
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!