Go Down

Topic: Servo language question (Read 2 times) previous topic - next topic


Two servo test code that can be modified to position a single servo in several different positions depending on the switch position.

Code: [Select]

//zoomkat servo button test 12-29-2011

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
int button2 = 5; //button pin, connect to ground to move servo
int press2 = 0;
Servo servo1;

void setup()
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  digitalWrite(4, HIGH); //enable pullups to make pin high
  digitalWrite(5, HIGH); //enable pullups to make pin high

void loop()
  press1 = digitalRead(button1);
  if (press1 == LOW)
  press2 = digitalRead(button2);
  if (press2 == LOW)
  /*else {

im pretty sure this would work its just i dont know how and where to insert it into my code to make it not change the position of the servo but change the delays and what pins on the arduino to connect the the pins on the switch
also can i just solder the servo positive to the positive on the switch to one pin and put that pin in the 5v on the arduino or would i need to get one of those breadboards that are like white plastic


i made this video a while back then just stopped caring about gettingthe wiper done because race season was over, but now its possible we are going to have a race in mid febuary so i figured i would get it done now, i hope this clearly explains my question


i know i sound like a dweeb, i was sick.

Go Up