Mano/Promano.ino

26 lines
375 B
Arduino
Raw Normal View History

2024-12-03 16:31:00 +01:00
#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);
}