Mano/Promano.ino

25 lines
375 B
C++

#include <Servo.h>
Servo myServo;
int const potPin = A0;
int potVal;
int angle;
void setup() {
myServo.attach(8);
Serial.begin(9600);
}
void loop() {
potVal = analogRead(potPin);
angle = map(potVal, 0, 1023, 0, 179);
Serial.print("Potval: ");
Serial.print(potVal);
Serial.print(" Angle: ");
Serial.print(angle);
myServo.write(angle);
delay(15);
}