Skip to content

Commit 0d409cb

Browse files
committed
add servobylib
1 parent 833210e commit 0d409cb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ServoBylib/ServoBylib.ino

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <Servo.h>
2+
3+
Servo servoX;
4+
Servo servoY;
5+
6+
void setup() {
7+
servoX.attach(12);
8+
servoY.attach(11);
9+
Serial.begin(115200);
10+
}
11+
12+
void loop() {
13+
int x = analogRead(A0);
14+
int y = analogRead(A1);
15+
int ax = map(x, 0, 1023, 0, 180);
16+
int ay = map(y, 0, 1023, 0, 180);
17+
servoX.write(ax);
18+
servoY.write(ay);
19+
delay(15);
20+
}

0 commit comments

Comments
 (0)