Initial Commit
This commit is contained in:
commit
5cb4ca8b7f
1 changed files with 25 additions and 0 deletions
25
Promano.ino
Normal file
25
Promano.ino
Normal file
|
@ -0,0 +1,25 @@
|
|||
#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);
|
||||
}
|
Loading…
Reference in a new issue