-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServo motors
26 lines (19 loc) · 940 Bytes
/
Servo motors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* PRIZM Controller example program
* This program sets the speed of servo 1 to 25%.
* Servo 1 is then rotated back and forth between 0 and 180 degree range.
* author PWU on 08/05/2016
*/
#include <PRIZM.h> // include the PRIZM library in the sketch
PRIZM prizm; // instantiate a PRIZM object “prizm” so we can use its functions
void setup() {
prizm.PrizmBegin(); // initialize the PRIZM controller
prizm.setServoSpeed(1,25); // set servo 1 speed to 25%
}
void loop() { // repeat in a loop
prizm.setServoPosition(1,180); // rotate servo1 to 180 degrees
delay(3000); // wait for 3 seconds to give servo1 time
// to get to position 180
prizm.setServoPosition(1,0); // rotate servo1 to 0 degrees
delay(3000); // wait for 3 seconds to give servo1 time
// to get to position 0
}