Need help with changing arduino code for more servos Answered

This code makes a continuous rotation servo motor turn on and run until you let go of the button. I need to change this sketch so that there are 3 buttons, instead of 1, and if I press 1, a continuous rotation servo would turn for each button until I let go of the button. #include Servo myServo; int servoPin = 2; int buttonPin = 7; int buttonState = 0; void setup() {   // put your setup code here, to run once: pinMode(buttonPin, INPUT); myServo.attach(servoPin); } void loop() {   // put your main code here, to run repeatedly: buttonState = digitalRead(buttonPin); if (buttonState == HIGH) {   myServo.write(0); }else{   myServo.write(90); } delay(15); }

Question by Orange robot 2 years ago  |  last reply 2 years ago


Rotating a simple DC motor really slowly (1 rotation per 2 hours)?

This is to rotate a bike chain on a small cog. After doing some research, I came across a component called a Pulse Width Modulator. Would this be suitable for turning a simple DC motor at 1 rotation per 12 hours(EDIT: I meant 1 rotation per 2 hours, not 1 every 12 hours)? Or, would it only get me to a certain point before I need to use gear ratios to achieve my ideal revs? This really is a budget project so nothing too fancy.  Thanks

Question by Nenagh 3 years ago  |  last reply 3 years ago


Help with modifying a servo for continuous rotation?

I want to build a robot with arduino and for the motors I was going to use some servos that I could modify for continuous rotation.  So, I picked up 2 cheap ones at radioshack.  I opened them up and I can get to the gears by removing the top part and I can get to the back of the circuit board by taking off the bottom.  But the circuit board is soldered in so I can't take it out to get to the potentiometer. I tried desoldering the connections to the motor but there seems to be more joints to desolder before I can take out the circuit board completely. And I don't want to desolder every joint and then have to solder them again when I need to put them back together.  So has anyone modified these radioshack servos and can tell me how to get tho the potentiometer? Or can anyone tell me if there is a way to modify them without getting to the potentiometer? Thanks.

Question by texpert 4 years ago  |  last reply 4 years ago