Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
servo_basic for photon robot
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
You can’t perform that action at this time.