Hi all,
I am relatively new to arduino, an the issue is with my code.
<
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode(7, INPUT_PULLUP); // pin 7 is input
}
void loop() {
if (digitalRead(7)== HIGH){ myservo.write(0);
}else { myservo.write(90);}}>
All i am trying to do is have the servo move to either position dependant on whether or not the input pin is HIGH or not.
I have a digital servo connected with the PWM pin to pin 9 or my arduino UNO. the servo is also wired to 5v and ground on the corresponding pins.
I am then putting pin 7 high from 5v. This makes no change to the servo position. Any help would be great cheers.