Member #45708

Member Since: August 16, 2008

Country: United States

  • Product ROB-09347 | about 3 years ago

    I am working on a piece where I need to hook up 7, full rotation servo motors to the arduino (each rotating at a different speed, some in one direction, others in the other) but basically an on/off with a motion sensor. <br /> <br /> I amusing an infrared sensor but the servo is still moving (awkwardly and jerky) when not sensing motion, but then runs as normal.<br /> Here is the code I am using (right now, I am only at 1 servo trying to get the sensor right first) :<br /> <br />

    include <br />

    <br /> Servo myservo;<br /> int potPin = 0; //analog pin used to connect the sensor<br /> int ledPin = 9; //select pin for the servo<br /> int val = 0; //variable to read the value from the analog pin<br /> void setup()<br /> {<br /> myservo.attach(9); //set up the servo as usual<br /> pinMode(ledPin, OUTPUT); //variable to store the value coming from the sensor<br /> Serial.begin(9600); //for watching the speeds in the serial monitor<br /> }<br /> <br /> void loop() {<br /> val = analogRead(potPin); // read the value from the sensor<br /> val = map(val,0,600,0,255);<br /> if (val>80) digitalWrite(ledPin, HIGH); //turn the ledPin on<br /> <br /> else if (val

No public wish lists :(