Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (13 sloc) 287 Bytes
#include <Servo.h>
Servo servoMotor;
int servoPin = 2;
void setup(){
Serial.begin(9600);
servoMotor.attach(servoPin);
}
void loop(){
int analogValue = analogRead(A1);
Serial.println(analogValue);
int servoAngle = map(analogValue, 0, 960, 0, 180);
servoMotor.write(servoAngle);
}