Created
April 27, 2016 22:53
-
-
Save Robotonics/4e632eb7e07496786bcba6cfe5bb3d2e to your computer and use it in GitHub Desktop.
servo_basic for photon robot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Servo Servo1; | |
Servo Servo2; | |
Servo Servo3; | |
Servo Servo4; | |
void setup() { | |
Servo1.attach(D0); | |
Servo2.attach(D1); | |
Servo3.attach(D2); | |
Servo4.attach(D3); | |
} | |
void loop() { | |
right(); | |
} | |
void reverse() | |
{ | |
Servo1.write(180); // front right | |
Servo2.write(0); // front left | |
Servo3.write(180); // rear right | |
Servo4.write(0); // rear left | |
} | |
void forward() | |
{ | |
Servo1.write(0); // front right | |
Servo2.write(180); // front left | |
Servo3.write(0); // rear right | |
Servo4.write(180); // rear left | |
} | |
void left() | |
{ | |
Servo1.write(0); // front right | |
Servo2.write(0); // front left | |
Servo3.write(0); // rear right | |
Servo4.write(0); // rear left | |
} | |
void right() | |
{ | |
Servo1.write(180); // front right | |
Servo2.write(180); // front left | |
Servo3.write(180); // rear right | |
Servo4.write(180); // rear left | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment